Android Studio RC 1 Gradle构建在更新后不会编译(Android Studio RC 1 Gradle build wont compile after update)
经过在互联网上的密集搜索后,我找不到任何问题的答案。 在我将android studio从beta升级到rc1之后,gradle构建脚本停止了以下错误:
Error:String index out of range: -1
我的构建脚本如下:
apply plugin: 'com.android.application'
repositories {
jcenter()
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 21
buildToolsVersion '21.1.1'
defaultConfig {
applicationId 'myappidhere'
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName '1.0'
}
lintOptions {
abortOnError false
}
android {
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src/main/java', 'src/main/java-gen']
res.srcDirs = ['src/main/res']
}
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.2'
compile 'com.android.support:support-v4:21.0.2'
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'com.jakewharton:butterknife:6.0.0'
compile 'com.jakewharton.timber:timber:2.5.0'
compile 'de.greenrobot:greendao:1.3.7'
compile 'com.rengwuxian.materialedittext:library:1.5.0'
//local libs
compile(name: 'utilsaaa1', ext: 'aar')
compile(name: 'pixlui_1_0_5_fork', ext: 'aar')
compile project(':Secure_preferences_lib')
}
阅读gradle日志错误后,有问题的行如下:
compile(name: 'utilsaaa1', ext: 'aar')
compile(name: 'pixlui_1_0_5_fork', ext: 'aar')
这两个文件都在文件夹libs中。 我不知道如何解决这个问题,所以任何帮助将不胜感激。
EDIT1:idea.log
Caused by: org.gradle.api.IllegalDependencyNotation: Supplied String module notation 'utilsaaa1' is invalid. Example notations: 'org.gradle:gradle-core:2.2', 'org.mockito:mockito-core:1.9.5:javadoc'.
After an intensive search on the internet, I couldn't find any answer to my problem. After I upgraded android studio from beta to rc1, the gradle build script stopped working with the following error:
Error:String index out of range: -1
My build script is as follows:
apply plugin: 'com.android.application'
repositories {
jcenter()
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 21
buildToolsVersion '21.1.1'
defaultConfig {
applicationId 'myappidhere'
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName '1.0'
}
lintOptions {
abortOnError false
}
android {
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src/main/java', 'src/main/java-gen']
res.srcDirs = ['src/main/res']
}
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.2'
compile 'com.android.support:support-v4:21.0.2'
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'com.jakewharton:butterknife:6.0.0'
compile 'com.jakewharton.timber:timber:2.5.0'
compile 'de.greenrobot:greendao:1.3.7'
compile 'com.rengwuxian.materialedittext:library:1.5.0'
//local libs
compile(name: 'utilsaaa1', ext: 'aar')
compile(name: 'pixlui_1_0_5_fork', ext: 'aar')
compile project(':Secure_preferences_lib')
}
After reading the gradle log error, the problematic lines are the following:
compile(name: 'utilsaaa1', ext: 'aar')
compile(name: 'pixlui_1_0_5_fork', ext: 'aar')
Both files are inside folder libs. I have no idea how to fix this so any help would be appreciated.
EDIT1: idea.log
Caused by: org.gradle.api.IllegalDependencyNotation: Supplied String module notation 'utilsaaa1' is invalid. Example notations: 'org.gradle:gradle-core:2.2', 'org.mockito:mockito-core:1.9.5:javadoc'.
原文:https://stackoverflow.com/questions/27253443
更新时间:2019-10-18 15:49
最满意答案
更改:
compile(name: 'utilsaaa1', ext: 'aar')
至:
compile 'myappidhere:utilsaaa1:1.0@aar'
Change:
compile(name: 'utilsaaa1', ext: 'aar')
To:
compile 'myappidhere:utilsaaa1:1.0@aar'
2014-12-04
相关问答
添加到位于应用程序模块中的build.gradle configurations {
all {
exclude module: 'httpclient'
exclude module: 'commons-logging'
}
}
Add to build.gradle located in app module configurations {
all {
exclude module: 'httpclient'
...
我终于找到了工作家伙 我必须删除 'C:\ Users \ Username \'中的.gradle文件夹,然后我用管理员权限打开AS,它恢复了生命! 感谢大家。 I finally got it working guys I had to delete the .gradle folder in 'C:\Users\Username\' and then I opened AS with admin rights and it came back to life! Thanks everyone
...
runProguard已被重命名为minifyEnabled 。 看到这里的更改日志确认 - 版本0.14.0(2014/10/31)的gradle插件做了交换。 runProguard has been renamed minifyEnabled. See the changelog here for confirmation - version 0.14.0 (2014/10/31) of the Android Gradle plugin made the swap.
开发人员正在努力。 就像我在这个答案中发布的那样,现在最快的解决方案就是使用命令行中的渐变,你应该切换到你不开发的所有模块的二进制库。 在g +上,与开发者讨论 。 The dev are working on it. Like I posted in this answer the fastest solution right now is to use gradle from the command line and you should switch to binary libs for a
...
您可以使用 compileSdkVersion 23
buildToolsVersion "23.0.0"
然后 点击按钮同步项目与Gradle文件应该做的伎俩: Tools -> Android -> Sync Project with Gradle Files 如果失败,请尝试运行重建项目 : Build -> Rebuild Project 有关详细信息,您可以访问 AndroidStudio:无法同步安装构建工具 You can use compileSdkVersion 23
buil
...
删除这个 $ANDROID_HOME/build-tools/and remove the 23.0.0-preview directory fixed the errors.
示例:在Windows中 C:\Users\Sharma\Desktop\xxx\Android\sdk\build-tools
希望这可以帮助 remove this $ANDROID_HOME/build-tools/and remove the 23.0.0-preview directory fixed the
...
更改: compile(name: 'utilsaaa1', ext: 'aar')
至: compile 'myappidhere:utilsaaa1:1.0@aar'
Change: compile(name: 'utilsaaa1', ext: 'aar')
To: compile 'myappidhere:utilsaaa1:1.0@aar'
根据: https : //code.google.com/p/android/issues/detail?id=221529 问题已经解决(确切地说:小时前)。 只是为了重建你的项目。 According to: https://code.google.com/p/android/issues/detail?id=221529 The problem is already fixed (exactly: hour ago). Just for sure rebuild your project.
...
打开File ,选择Project Structure... ,然后在SDK Location搜索Android SDK使用... buttton,然后单击OK Open File, choose Project Structure..., then in SDK Location search for Android SDK using ... buttton and click OK
你应该在gradle/wrapper/gradle-wrapper.properties更改gradle url you should change the gradle url in gradle/wrapper/gradle-wrapper.properties