我最近将Android Studio更新为版本3.0.1,当我尝试打开旧项目以扩展其功能时。在启动期间它被困在Gradle Building中,所以我找了一些解决方案然后我尝试了这个。 (this link)
现在工作室能够打开我的项目,然后我按照要求更新了一些依赖项并尝试同步但是这就出来了,
C:\Users\3537\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-4.1\caches\transforms-1\files-1.1\play-services-base-11.0.4.aar\a2c4fe108b0bd423ffb8601a316a793a\res\drawable-xxhdpi-v4\common_google_signin_btn_icon_light_normal_background.9.png: error: file not found.
C:\Users\3537\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-4.1\caches\transforms-1\files-1.1\play-services-base-11.0.4.aar\a2c4fe108b0bd423ffb8601a316a793a\res\drawable-hdpi-v4\common_google_signin_btn_icon_dark_normal_background.9.png: error: file not found.
C:\Users\3537\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-4.1\caches\transforms-1\files-1.1\play-services-base-11.0.4.aar\a2c4fe108b0bd423ffb8601a316a793a\res\drawable-mdpi-v4\common_google_signin_btn_text_dark_normal_background.9.png: error: file not found.
C:\Users\3537\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-4.1\caches\transforms-1\files-1.1\play-services-base-11.0.4.aar\a2c4fe108b0bd423ffb8601a316a793a\res\drawable-xxhdpi-v4\common_google_signin_btn_icon_dark_normal_background.9.png: error: file not found.
C:\Users\3537\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-4.1\caches\transforms-1\files-1.1\play-services-auth-11.0.4.aar\130bbdf2e58a977ac16e514bcd3a274f\res\drawable-watch-v20\common_google_signin_btn_text_light_normal.xml: error: file not found.
C:\Users\3537\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-4.1\caches\transforms-1\files-1.1\play-services-base-11.0.4.aar\a2c4fe108b0bd423ffb8601a316a793a\res\drawable-xhdpi-v4\common_google_signin_btn_text_dark_normal_background.9.png: error: file not found.
C:\Users\3537\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-4.1\caches\transforms-1\files-1.1\play-services-base-11.0.4.aar\a2c4fe108b0bd423ffb8601a316a793a\res\drawable-xhdpi-v4\common_google_signin_btn_icon_dark_normal_background.9.png: error: file not found.
C:\Users\3537\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-4.1\caches\transforms-1\files-1.1\play-services-base-11.0.4.aar\a2c4fe108b0bd423ffb8601a316a793a\res\drawable-xhdpi-v4\common_google_signin_btn_icon_light_normal_background.9.png: error: file not found.
C:\Users\3537\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-4.1\caches\transforms-1\files-1.1\play-services-base-11.0.4.aar\a2c4fe108b0bd423ffb8601a316a793a\res\drawable-hdpi-v4\common_google_signin_btn_icon_light_normal_background.9.png: error: file not found.
C:\Users\3537\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-4.1\caches\transforms-1\files-1.1\play-services-base-11.0.4.aar\a2c4fe108b0bd423ffb8601a316a793a\res\drawable-hdpi-v4\common_google_signin_btn_text_dark_normal_background.9.png: error: file not found.
C:\Users\3537\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-4.1\caches\transforms-1\files-1.1\play-services-base-11.0.4.aar\a2c4fe108b0bd423ffb8601a316a793a\res\drawable-mdpi-v4\common_google_signin_btn_icon_light_normal_background.9.png: error: file not found.
C:\Users\3537\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-4.1\caches\transforms-1\files-1.1\play-services-base-11.0.4.aar\a2c4fe108b0bd423ffb8601a316a793a\res\drawable-xxhdpi-v4\common_google_signin_btn_text_dark_normal_background.9.png: error: file not found.
C:\Users\3537\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-4.1\caches\transforms-1\files-1.1\play-services-auth-11.0.4.aar\130bbdf2e58a977ac16e514bcd3a274f\res\drawable-watch-v20\common_google_signin_btn_text_dark_normal.xml: error: file not found.
C:\Users\3537\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-4.1\caches\transforms-1\files-1.1\play-services-base-11.0.4.aar\a2c4fe108b0bd423ffb8601a316a793a\res\drawable-xxhdpi-v4\common_google_signin_btn_text_light_normal_background.9.png: error: file not found.
C:\Users\3537\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-4.1\caches\transforms-1\files-1.1\play-services-base-11.0.4.aar\a2c4fe108b0bd423ffb8601a316a793a\res\drawable-mdpi-v4\common_google_signin_btn_text_light_normal_background.9.png: error: file not found.
C:\Users\3537\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-4.1\caches\transforms-1\files-1.1\play-services-base-11.0.4.aar\a2c4fe108b0bd423ffb8601a316a793a\res\drawable-xhdpi-v4\common_google_signin_btn_text_light_normal_background.9.png: error: file not found.
C:\Users\3537\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-4.1\caches\transforms-1\files-1.1\play-services-base-11.0.4.aar\a2c4fe108b0bd423ffb8601a316a793a\res\drawable-mdpi-v4\common_google_signin_btn_icon_dark_normal_background.9.png: error: file not found.
C:\Users\3537\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-4.1\caches\transforms-1\files-1.1\play-services-base-11.0.4.aar\a2c4fe108b0bd423ffb8601a316a793a\res\drawable-hdpi-v4\common_google_signin_btn_text_light_normal_background.9.png: error: file not found.
Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
:app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
这一切都说找不到文件,但是当我检查到该目录时,所有文件都在那里。
我的Gradle文件......
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.purvik.app"
minSdkVersion 16
targetSdkVersion 25
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(include: ['*.jar'], dir: 'libs')
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.firebase:firebase-messaging:11.0.4'
compile 'com.firebaseui:firebase-ui:2.2.0'
compile 'com.google.android.gms:play-services-ads:11.0.4'
compile 'com.google.android.gms:play-services-auth:11.0.4'
compile 'com.android.support:support-v4:25.4.0'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:recyclerview-v7:25.4.0'
compile 'com.android.support:design:25.4.0'
compile 'com.android.support:cardview-v7:25.4.0'
// FirebaseUI for Firebase Realtime Database
implementation 'com.firebaseui:firebase-ui-database:2.2.0'
// FirebaseUI for Firebase Auth
implementation 'com.firebaseui:firebase-ui-auth:2.2.0'
enter code here
// FirebaseUI for Cloud Storage
implementation 'com.firebaseui:firebase-ui-storage:2.2.0'
}
apply plugin: 'com.google.gms.google-services'
如果有人有任何想法,那么回复以便我可以解决它。
编辑:
尝试了很多事情。后来我在新窗口中创建了一个新项目。然后查看默认情况下所依赖的依赖项。复制它并在我的旧项目build.gradle文件中更新该版本。我一个接一个地将依赖项添加到我的新项目中,如果它成功构建,我将更新旧的依赖项到该版本。这解决了我的依赖项不匹配错误。
最重要的内部模块gradle.properties文件add,
android.enableAapt2=false
行所以它不会查找那些png文件错误。 (从this answer找到)现在我能够如何创建旧项目的成功构建。希望它会有所帮助。
答案 0 :(得分:0)
尝试将gradle版本更改为27,或手动删除gradle缓存
答案 1 :(得分:0)
AAPT2确实存在长路径(>大约140个字符)或带有非ascii字符的路径的问题。这看起来像是由长路径引起的。这已得到修复,但尚未发布,因此当前的解决方法是将缓存目录移近C:root或暂时禁用AAPT2。修复程序应尽快发布。