android studio rc,Android Studio RC 1 Gradle构建在更新后不会编译(Android Studio RC 1 Gradle build wont compile...

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Android Studio 2023.2.1中,build.gradle文件位于项目的根目录下。它用于配置项目的构建设置和依赖项。具体来说,build.gradle文件分为两个部分:项目级别的build.gradle和模块级别的build.gradle。 1. 项目级别的build.gradle:该文件位于项目的根目录下,用于配置整个项目的构建设置。你可以在该文件中指定项目的构建工具版本、仓库地址、全局依赖等。通常,你可以在该文件中找到类似以下内容的代码块: ``` // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:4.3.1' } } allprojects { repositories { google() jcenter() } } ``` 2. 模块级别的build.gradle:该文件位于每个模块的目录下,用于配置该模块的构建设置和依赖项。你可以在该文件中指定模块的应用ID、最小SDK版本、目标SDK版本、依赖库等。通常,你可以在该文件中找到类似以下内容的代码块: ``` plugins { id 'com.android.application' } android { compileSdkVersion 31 defaultConfig { applicationId "com.example.myapp" minSdkVersion 21 targetSdkVersion 31 // ... } // ... } dependencies { implementation 'com.android.support:appcompat-v7:28.0.0' // ... } ``` 综上所述,你可以在项目的根目录下找到项目级别的build.gradle文件,而在每个模块的目录下找到模块级别的build.gradle文件。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值