1. 程式人生 > >aapt.exe finished with non-zero exit value 1

aapt.exe finished with non-zero exit value 1

在一個APP 中匯入 嚴振杰的 ALBUM,出現錯誤

在網上找了各種,最後在 stackoverflow上找到這樣的說法

-Go to File->project structure->Project
-Check Android plugin Version and change it to 1.3.0(Latest one)
-Go to File->project structure->app->Properties->Build Tools Version
-Change it to latest one(22.0.1). Also do
this for any other module you have for your project. -Clean and build project.

我大致明白,可能是因為版本的問題。

我就去檢視album的版本:

android = [
            applicationId    : "com.yanzhenjie.album.sample",
            compileSdkVersion: 28,
            buildToolsVersion: "28.0.3",

            minSdkVersion    : 
14, targetSdkVersion : 28, versionCode : 27, versionName : "2.1.3", ]

而我的執行版本呢:

//ext {
//    compileSdkVersion = 27
//    buildToolsVersion = "27.0.0"
//    minSdkVersion = 14
//    targetSdkVersion = compileSdkVersion
//
//    v4Version = "27.0.1"
//}

被引入的版本高於我的執行版本,直接把我的改成高版本的,如下:

ext {
    compileSdkVersion = 28
    buildToolsVersion = "28.0.3"
    minSdkVersion = 14
    targetSdkVersion = 28

    v4Version = "27.0.1"
}

然後執行能過!

至此解決了!

說實話,在用android studio的過程中遇到好多坑!都是這樣一步步走來的,

回望,真的是步步皆辛苦!