當我更新我的android studio到3.0 beta7,生成失敗並出現異常。任務':app:packageDebug'的執行失敗。無法創建目錄
- 出了什麼問題: 執行失敗的任務 ':應用程序:packageDebug'。 無法創建目錄F:\項目\我的項目路徑\程序\編譯\輸出\ APK \調試
我清除緩存,重新啓動計算機和機器人工作室,但它不工作總之,我現在應該怎麼做?
我殺進程的Java(TM)平臺SE二進制文件,並刪除構建高速緩存,它不工作,要麼
當我更新我的android studio到3.0 beta7,生成失敗並出現異常。任務':app:packageDebug'的執行失敗。無法創建目錄
- 出了什麼問題: 執行失敗的任務 ':應用程序:packageDebug'。 無法創建目錄F:\項目\我的項目路徑\程序\編譯\輸出\ APK \調試
我清除緩存,重新啓動計算機和機器人工作室,但它不工作總之,我現在應該怎麼做?
我殺進程的Java(TM)平臺SE二進制文件,並刪除構建高速緩存,它不工作,要麼
我有固定的問題。
https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html
從AS 3.0,使用變API來操縱變種產出與新插件壞了,它只能用來改變APK名稱,而不是路徑。
我在AS 2.3改變輸出路徑,因此它構建失敗
解決方案是什麼?謝謝 – lacas
我得到了解決辦法從這裏Migrate to Android Plugin for Gradle 3.0.0
android.applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "${variant.name}-${variant.versionName}.apk"
}
}
我也面臨着同樣的問題,但它解決了以下一些簡單的步驟:
打開app.gradle和替換applicationVariants.all到這個..
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.app.sample.news"
minSdkVersion 14
targetSdkVersion 26
versionCode 7
versionName "2.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig getSigningConfig()
// change code from here to......
applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "${variant.name}-${variant.versionName}.apk"
}
}
//here....
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
/* IMPORTANT :
* Be careful when update dependencies, different version library may caused error */
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:cardview-v7:26.+'
compile 'com.android.support:recyclerview-v7:26.+'
compile 'com.android.support:design:26.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:support-v4:26.+'
compile 'com.balysv:material-ripple:1.0.2'
}
點擊同步
這爲我工作!
1.打開app.graddle文件,並替換applicationVariants.all ......與
android.applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "${variant.name}-${variant.versionName}.apk"
}
}
2.建設 - >做項目
3.然後生成您簽名的APK
[Execution failed for task':app:packageDebug' - 無法讀取zip文件]的可能重複(https://stackoverflow.com/questions/37347291/execution-failed-for-task-apppackagedebug-failed-to -read-zip-file) – pringi
我試過那裏的答案,但不起作用 –
我有同樣的問題..你修好了嗎? –