无法通过升级到 android gradle 3.0 构建项目
Unable to build project with upgrade to android gradle 3.0
我正在尝试将 android JavaVersion.VERSION_1_7
更新为 JavaVersion.VERSION_1_8
。我正在使用 Canary 分支的 Android Studio 3.0 Beta 2。看起来我做了 by the book ,但我无法使用新设置编译我的项目。我在下面提供了我的 gradle 文件的简要说明和错误日志作为组装构建的输出。
这是我的 gradle 文件的构建脚本部分。
Gradle buildscript
buildscript {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'org.aspectj:aspectjtools:1.8.6'
}
}
Gradle android
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 25
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
}
// API 23 removes the http apache libraries, we require this to continue using them. We should
// eventually move away from them and then remove this
useLibrary 'org.apache.http.legacy'
flavorDimensions "default"
productFlavors {
// product flavors here
}
}
错误
Issues:
- WARN: {PROJECT-PATH}/core/res/layout/preference_layout.xml:20 generated id android:id/summary for external package android
- WARN: {PROJECT-PATH}/core/res/layout/preference_category_layout.xml:15 generated id android:id/title for external package android
- ERROR: {PROJECT-PATH}/androidSDK/build/intermediates/incremental/mergeAospDebugResources/merged.dir/values/values.xml:6213 style attribute @android:attr/windowEnterAnimation not found
- ERROR: {PROJECT-PATH}/androidSDK/build/intermediates/incremental/mergeAospDebugResources/merged.dir/values/values.xml:6214 style attribute @android:attr/windowExitAnimation not found
- ERROR: {PROJECT-PATH}/androidSDK/build/intermediates/incremental/mergeAospDebugResources/merged.dir/values/values.xml:6226 style attribute @android:attr/windowEnterAnimation not found
- ERROR: {PROJECT-PATH}/androidSDK/build/intermediates/incremental/mergeAospDebugResources/merged.dir/values/values.xml:6227 style attribute @android:attr/windowExitAnimation not found
- ERROR: failed linking references
at com.android.builder.internal.aapt.v2.AaptV2Jni.buildException(AaptV2Jni.java:154)
at com.android.builder.internal.aapt.v2.AaptV2Jni.makeValidatedPackage(AaptV2Jni.java:98)
at com.android.builder.internal.aapt.AbstractAapt.link(AbstractAapt.java:40)
... 49 more
我发现了错误。我实际上不得不从属性名称中删除 "@"
字符:
之前:
<style name="slideUpAnimation">
<item name="@android:windowEnterAnimation">@anim/slide_in_bottom</item>
<item name="@android:windowExitAnimation">@anim/slide_out_bottom</item>
</style>
之后
<style name="slideUpAnimation">
<item name="android:windowEnterAnimation">@anim/slide_in_bottom</item>
<item name="android:windowExitAnimation">@anim/slide_out_bottom</item>
</style>
我正在尝试将 android JavaVersion.VERSION_1_7
更新为 JavaVersion.VERSION_1_8
。我正在使用 Canary 分支的 Android Studio 3.0 Beta 2。看起来我做了 by the book ,但我无法使用新设置编译我的项目。我在下面提供了我的 gradle 文件的简要说明和错误日志作为组装构建的输出。
这是我的 gradle 文件的构建脚本部分。
Gradle buildscript
buildscript {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'org.aspectj:aspectjtools:1.8.6'
}
}
Gradle android
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 25
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
}
// API 23 removes the http apache libraries, we require this to continue using them. We should
// eventually move away from them and then remove this
useLibrary 'org.apache.http.legacy'
flavorDimensions "default"
productFlavors {
// product flavors here
}
}
错误
Issues:
- WARN: {PROJECT-PATH}/core/res/layout/preference_layout.xml:20 generated id android:id/summary for external package android
- WARN: {PROJECT-PATH}/core/res/layout/preference_category_layout.xml:15 generated id android:id/title for external package android
- ERROR: {PROJECT-PATH}/androidSDK/build/intermediates/incremental/mergeAospDebugResources/merged.dir/values/values.xml:6213 style attribute @android:attr/windowEnterAnimation not found
- ERROR: {PROJECT-PATH}/androidSDK/build/intermediates/incremental/mergeAospDebugResources/merged.dir/values/values.xml:6214 style attribute @android:attr/windowExitAnimation not found
- ERROR: {PROJECT-PATH}/androidSDK/build/intermediates/incremental/mergeAospDebugResources/merged.dir/values/values.xml:6226 style attribute @android:attr/windowEnterAnimation not found
- ERROR: {PROJECT-PATH}/androidSDK/build/intermediates/incremental/mergeAospDebugResources/merged.dir/values/values.xml:6227 style attribute @android:attr/windowExitAnimation not found
- ERROR: failed linking references
at com.android.builder.internal.aapt.v2.AaptV2Jni.buildException(AaptV2Jni.java:154)
at com.android.builder.internal.aapt.v2.AaptV2Jni.makeValidatedPackage(AaptV2Jni.java:98)
at com.android.builder.internal.aapt.AbstractAapt.link(AbstractAapt.java:40)
... 49 more
我发现了错误。我实际上不得不从属性名称中删除 "@"
字符:
之前:
<style name="slideUpAnimation">
<item name="@android:windowEnterAnimation">@anim/slide_in_bottom</item>
<item name="@android:windowExitAnimation">@anim/slide_out_bottom</item>
</style>
之后
<style name="slideUpAnimation">
<item name="android:windowEnterAnimation">@anim/slide_in_bottom</item>
<item name="android:windowExitAnimation">@anim/slide_out_bottom</item>
</style>