未找到 Android Studio Gradle DSL 方法:'android()'

Android Studio Gradle DSL method not found: #39;android()#39; -- Error(17,0)(未找到 Android Studio Gradle DSL 方法:android() -- 错误 (17,0))
本文介绍了未找到 Android Studio Gradle DSL 方法:'android()' -- 错误 (17,0)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Android Studio 中运行我的项目,但出现以下错误:

I am attempting to run my project in Android Studio but the error appears below:

我已经跟踪了许多来源,只是为了让它运行并在这里结束,但不知道还能做什么.

I have followed many sources just to get this to run and have wound up here, but do not know what else to do.

如何配置此项目以运行?

How can I configure this project to run?

build.gradle:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:0.9.+'
        }
    }

    allprojects {
        repositories {
            mavenCentral()
        }
    }

    android {
        compileSdkVersion 19
        buildToolsVersion "19.1" 
    }

settings.gradle:

include ':app'

local.properties:

sdk.dir=C:\Users\KJA\AppData\Local\Android\sdk

gradle.propertes:

# IDE (e.g. Android Studio) users:
# Settings specified in this file will override any Gradle settings
# configured through the IDE.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

推荐答案

我继续从您提供的链接下载项目:http://javapapers.com/android/android-chat-bubble/

I went ahead and downloaded the project from the link you provided: http://javapapers.com/android/android-chat-bubble/

由于这是一个旧教程,您只需升级软件、gradle、android 构建工具和插件.

Since this is an old tutorial, you simply need to upgrade the software, gradle, the android build tools and plugin.

  • https://www.gradle.org/
  • http://tools.android.com/tech-docs/new-build-system/version-compatibility
buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

app/build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.3'

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 23
        versionCode 1
        versionName '1.0'
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:23.2.1'
}

然后运行gradle:

gradle installDebug

这篇关于未找到 Android Studio Gradle DSL 方法:'android()' -- 错误 (17,0)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)