简体   繁体   English

关于最新的android studio 3.0.1的Gradle 4.1问题

[英]Gradle 4.1 issue on latest android studio 3.0.1

Though I have an updated android studio I am getting the following error but I cannot find gradle 4.1 in the gradle folder but when I check file -> project structure -> gradle plugin is 4. 虽然我有一个更新的android工作室我收到以下错误但我找不到Gradle文件夹中的gradle 4.1但是当我检查文件 - >项目结构 - > gradle插件是4。

Error:Could not find com.android.tools.build:gradle:4.1.
Searched in the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/4.1/gradle-4.1.pom
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/4.1/gradle-4.1.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/4.1/gradle-4.1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/4.1/gradle-4.1.jar
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1/gradle-4.1.pom
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1/gradle-4.1.jar

And my build.gradle file is this. 我的build.gradle文件就是这个。 I set it to 23 because I need to run it on 5.0.1 phone. 我把它设置为23因为我需要在5.0.1手机上运行它。

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
    applicationId "com.example.threewire.myapplication"
    minSdkVersion 10
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}

check your tools version, it should be 3.0.1 检查你的工具版本,它应该是3.0.1

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

please note that google() repository is important. 请注意, google()存储库很重要。 the newer plugin is posted there. 新的插件发布在那里。

尝试在存储库中添加google()

For my project is correct next construction in "build.gradle": 对于我的项目是正确的“build.gradle”中的下一个构造:

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

您可以将此语句添加到gradle.properties文件中

android.enableAapt2=false

Try to reinstall the android version you are using with standard settings. 尝试使用标准设置重新安装您正在使用的Android版本。 use stable version instead for your computer 使用稳定版本代替您的计算机

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有gradle build 4.1的android studio 3.0.1中的Gradle同步错误 - Gradle sync error in android studio 3.0.1 with gradle build 4.1 无法将android studio 3.0.1中的dex与最新的gradle合并 - Unable to merge dex in android studio 3.0.1 with latest gradle 将 Android Studio 的 Gradle 插件升级到 3.0.1 和 Gradle 到 4.1 后无法复制配置依赖项 - Not able to copy configurations dependencies after upgrading Gradle plugin for Android Studio to 3.0.1 and Gradle to 4.1 Android Studio 3.0.1的问题 - Issue with Android Studio 3.0.1 我们如何将CMake或ndk-build集成到Android Studio 3.0.1中? Gradle版本为4.1,Android插件版本3.0.1 - How can we Integrate CMake or ndk-build into Android Studio 3.0.1? Gradle version is 4.1, android plugin version 3.0.1 数据绑定Android Studio Gradle 3.0.1 - Databinding Android Studio Gradle 3.0.1 Android ProGuard使用gradle插件3.0.1(4.1?)构建已签名的apk失败 - Android ProGuard Building a signed apk fails with gradle plugin 3.0.1 (4.1?) 在Android Studio中将gradle更新为4.1 - Update gradle to 4.1 in Android Studio Android Studio 3.0.1中的Gradle同步字段 - Gradle sync field in android studio 3.0.1 Android Studio 3.0.1上的Gradle项目同步失败 - Gradle project sync failed on Android Studio 3.0.1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM