当前位置: 首页 > 知识库问答 >
问题:

将Android Studio 3.3更新为3.4后,生成AAPT2错误

公西永嘉
2023-03-14

更新后Android Studio 3.3到3.4它得到错误。它得到一个错误,是AAPT2和提供我一个建议我喜欢这个:

此版本中使用了不推荐的Gradle功能,使其与Gradle 6.0不兼容。使用“--warning mode all”显示单个弃用警告。看见

gradle.properties
org.gradle.warning.mode=all

但它仍然不起作用。

错误:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeIntroMakerDebugResources'.
> 8 exceptions were raised by workers:
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #2: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #0: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #1: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #3: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #4: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #5: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #6: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #7: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 23s

这是一个构建。渐变文件:

buildscript {

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    // The Fabric Gradle plugin uses an open ended version to react
    // quickly to Android tooling updates
    classpath 'io.fabric.tools:gradle:1.+'
}
 }

plugins {
id "com.onesignal.androidsdk.onesignal-gradle-plugin" version "0.12.1"
 }

   apply plugin: 'com.android.application'
 //Put Fabric plugin after Android plugin
 apply plugin: 'io.fabric'
  apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
signingConfigs {
    config {
        keyAlias 'maker_key'
        keyPassword '!23342'
        storeFile 
       file('E:/axita.savani/Android_Project/AppCred/maker_key.jks')
        storePassword '!23342'
    }
}
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
    applicationId "com.example.myapplication"
    minSdkVersion 17
    targetSdkVersion 28
       vectorDrawables.useSupportLibrary = true
    multiDexEnabled true
    ndk {
        abiFilters "armeabi-v7a", "x86", "arm64-v8a"
    }
}
buildTypes {
    debug {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android- 
     optimize.txt'), 'proguard-rules.pro'
        zipAlignEnabled true
        shrinkResources false
        externalNativeBuild { ndkBuild { cFlags '-DDEBUG' } }
    }
    release {
        debuggable false
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android- 
     optimize.txt'), 'proguard-rules.pro'
        zipAlignEnabled true
        shrinkResources true
        externalNativeBuild { ndkBuild { cFlags '-DRELEASE' } }
    }
}

sourceSets {
    main {
        res.srcDirs =
                [
                        'src/main/res/layouts/activities',
                        'src/main/res/layouts/fragments',
                        'src/main/res/layouts/background',
                        'src/main/res/layouts/camera',
                        'src/main/res/layouts/sticker',
                        'src/main/res/layouts/text',
                        'src/main/res/layouts/editor',
                        'src/main/res/layouts/commom',
                        'src/main/res/layouts/other',
                        'src/main/res/layouts/videotrimmer',
                        'src/main/res/layouts/obgallarylib',
                        'src/main/res/layouts/template',
                        'src/main/res/layouts/eraser',
                        'src/main/res/layouts/user_guide',
                        'src/main/res/layouts/my_art',
                        'src/main/res/layouts/audio',
                        'src/main/res/layouts/video',

                        'src/main/res/layouts-land/activities',
                        'src/main/res/layouts-land/fragments',
                        'src/main/res/layouts-land/background',
                        'src/main/res/layouts-land/camera',
                        'src/main/res/layouts-land/sticker',
                        'src/main/res/layouts-land/text',
                        'src/main/res/layouts-land/editor',
                        'src/main/res/layouts-land/commom',
                        'src/main/res/layouts-land/other',
                        'src/main/res/layouts-land/my_art',

                        'src/main/res/layouts',
                        'src/main/res/layouts-land',
                        'src/main/res'
                ]
    }
}

  android {
    aaptOptions {
        ignoreAssetsPattern "!*ffprobe"
    }
    dexOptions {
        jumboMode true
    }
    lintOptions {
        disable 'GoogleAppIndexingWarning'
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in 
 release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }
}

def flavorName = 'Maker'
// todo change in flavorname which app is used

externalNativeBuild {
    ndkBuild {
        path "src/${flavorName}/jni/Android.mk"
    }
}

flavorDimensions "default"

product flavors {

    // ONE SIGNAL IDs
        Maker {
        applicationId "com.example.maker"

        versionCode 9
        versionName "9.0"
        flavorDimensions "default"
        signingConfig signingConfigs.config
        setProperty("archivesBaseName", 
    "Business_$versionName.$versionCode")
    }


}

packagingOptions {
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/LGPL2.1'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/notice.txt'
}
compileOptions {
    sourceCompatibility 1.8
    targetCompatibility 1.8
}
}

  dependencies {
/*TODO one Signal*/
implementation 'com.onesignal:OneSignal:3.10.6'

implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:appcompat-v7:28.0.0'
 //    implementation 'com.android.support:customtabs:27.1.1'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
//implementation 'com.android.support:palette-v7:27.1.1'
implementation 'com.google.code.gson:gson:2.8.5'

 //    implementation 'com.github.yalantis:ucrop:2.2.1'
implementation 'com.github.yalantis:ucrop:2.2.2'

//    implementation 'com.kbeanie:multipicker:1.1.31@aar'
   //    implementation project(path: ':multipicker')

    /*database Dislay From chorome used this */
implementation 'com.facebook.stetho:stetho:1.5.0'

implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'

/* Pinch zoom image */
//implementation 'com.davemorrissey.labs:subsampling-scale-image- 
 view:3.6.0'

implementation 'com.viewpagerindicator:library:2.4.1@aar'

/*GIF Image View*/
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.16'

/* YOYO animation*/
implementation 'com.daimajia.easing:library:2.0@aar'
implementation 'com.daimajia.androidanimations:library:2.3@aar'

implementation 'com.codemybrainsout.rating:ratingdialog:1.0.8'

/* FCM */
//    implementation 'com.google.firebase:firebase-messaging:15.0.2'
/* AdMob */
implementation 'com.google.firebase:firebase-ads:17.2.0'

/* InAppPurchase */
implementation 'com.android.billingclient:billing:1.2'

/* EU User Consent SDK */
implementation 'com.google.android.ads.consent:consent-library:1.0.7'

//For Crash analytics
implementation('com.crashlytics.sdk.android:crashlytics:2.9.7@aar') {
    transitive = true
}

implementation 'com.azeesoft.lib.colorpicker:colorpicker:1.0.9@aar'
implementation 
'com.h6ah4i.android.widget.verticalseekbar:verticalseekbar:0.7.2'


implementation 'nl.bravobit:android-ffmpeg:1.1.5'
implementation 'com.googlecode.mp4parser:isoparser:1.1.22'
/*storage for path */
implementation 'com.snatik:storage:2.1.0'
/*exo player for Audio and Video */
implementation 'com.devbrackets.android:exomedia:4.3.0'

/*Download file From Server */
implementation 'com.mindorks.android:prdownloader:0.5.0'

      /*Ob Volly library*/
implementation 'com.optimumbrew.corelib:networking-volly:8.0.8'
   /*Audio picker library */
implementation 'com.optimumbrew.picker:audiopicker:1.1.17'

/* Optimumbrew Image loader*/
implementation 'com.optimumbrew.obglide:obglide:2.0.2'
/* inhouse ads library*/
implementation 'com.optimumbrew.obinhouseads:obinhouseads:11.0.11'

implementation project(path: ':spacelib')

/*Video Tools*/
implementation project(':video-record')
implementation project(':video-compressor')
implementation project(':video-effect')

implementation 'com.daasuu:ExoPlayerFilter:0.2.3'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.1.5'
implementation 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.4@aar'

implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

//exo player note : Don't upgrade of exoplayer vesion
implementation 'com.google.android.exoplayer:exoplayer:2.9.1'

implementation 'com.android.volley:volley:1.1.1'




}
   //apply plugin: 'com.google.gms.google-services' // Use for FCM Push

共有2个答案

云捷
2023-03-14

请将build script{更改为buildscript{,不留空格。它会起作用。还请尝试在“gradle wrapper.properties”中使用distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip,然后再次同步

杨学真
2023-03-14

使用./gradlew构建-警告模式在Android Studio终端中获取更多信息。

首先要做的始终是重新启动无效缓存。

 类似资料:
  • 在创建项目时更新android studio后,我收到一个错误: 错误:任务“:app:preDebugAndroidTestBuild”的执行失败。与依赖项com冲突。Android支持:支持注释“在项目中”:应用程序。app(26.1.0)和测试app(27.1.1)的解析版本有所不同。看见https://d.android.com/r/tools/test-apk-dependency-co

  • 我尝试了“multidexenabled true”和“”,但错误继续出现。似乎有一些构建问题。这是什么?

  • 将一个旧项目上的Gradle更新为最新版本,我收到以下错误:。gradle\caches\transforms-1\files-1.1\CreditCardEntry-1.4.8.10。aar\453339e1f1fb2382e8ce2362a0acdedd\res\values\values。xml:11:5-54:AAPT:error:内部元素必须是资源引用或为空。 我不明白为什么会出现这个错

  • 我是java和Android的新手。我正在尝试在Win7上使用android studio构建一个android浏览器。尝试构建我的应用程序时会出现以下错误: Android资源编译失败输出:C:\users\borinqueNatl\AndroidStudioProjects\browserexample\app\src\main\res\layout\activity_main.xml:34:

  • 我所有的谷歌存储库都是最新的。SDK管理器中没有显示要更新的内容。 如何解决这个问题 多谢了。

  • 我正在尝试使用最新的库作为我需求的一部分。我确实将gradle版本升级到了3.1。4和所有具有匹配编译和目标SDK版本的支持库,但在构建项目时 错误:清单合并失败:属性application@appComponentFactory值=(android.support.v4.app.CoreComponentFactory)来自[com.android.support: support-compat