file tree image is here构建捆绑文件时出现此错误。但是.apk文件构建成功。 面对这种新问题 以下错误消息
org.gradle.api.tasks.TaskExecutionException:任务':app:packageDebugBundle'的执行失败。 在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103) 在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73) 在org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)处 在org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59) 在org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54) 在org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59) 在org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)处 在org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44) 在org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91) 在org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)处 在org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59) 在org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54) 在org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) 在org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34) 在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker $ 1.run(DefaultTaskGraphExecuter.java:256) 在org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)处 在org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) 在org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) 在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) 在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)处 在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)处 在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)处 在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.access $ 200(DefaultTaskPlanExecutor.java:79) 在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker $ 1.execute(DefaultTaskPlanExecutor.java:104) 在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker $ 1.execute(DefaultTaskPlanExecutor.java:98) 在org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)处 在org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597) 在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98) 在org.gradle.internal.concurrent.ExecutorPolicy $ CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) 在org.gradle.internal.concurrent.ManagedExecutorImpl $ 1.run(ManagedExecutorImpl.java:46) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617) 在org.gradle.internal.concurrent.ThreadFactoryImpl $ ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) 在java.lang.Thread.run(Thread.java:745) 引起原因:org.gradle.internal.UncheckedException:java.util.concurrent.ExecutionException:com.android.tools.build.bundletool.exceptions.BundleFileTypesException $ FileUsesReservedNameException:文件'root / res / drawable / sr_list_item_background.xml'使用保留文件或目录名称“ res”。 在org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:63) 在org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40) 在org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:76) 在org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46) 在org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39) 在org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26) 在org.gradle.api.internal.AbstractTask $ TaskActionWrapper.execute(AbstractTask.java:788) 在org.gradle.api.internal.AbstractTask $ TaskActionWrapper.execute(AbstractTask.java:755) 在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter $ 1.run(ExecuteActionsTaskExecuter.java:124) 在org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)处 在org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) 在org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) 在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) 在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)处 在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95) ...更多33 由以下原因引起:java.util.concurrent.ExecutionException:com.android.tools.build.bundletool.exceptions.BundleFileTypesException $ FileUsesReservedNameException:文件'root / res / drawable / sr_list_item_background.xml'使用保留的文件或目录名称'res'。 在java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1006) 在com.android.ide.common.workers.ExecutorServiceAdapter.close(ExecutorServiceAdapter.kt:56) 在kotlin.io.CloseableKt.closeFinally(Closeable.kt:65) 在com.android.build.gradle.internal.tasks.BundleTask.bundleModules(BundleTask.kt:128) 在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处 在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:498) 在org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) ...另外45个 引起原因:com.android.tools.build.bundletool.exceptions.BundleFileTypesException $ FileUsesReservedNameException:文件'root / res / drawable / sr_list_item_background.xml'使用保留文件或目录名称'res'。 在com.android.tools.build.bundletool.validation.BundleFilesValidator.validateModuleFile(BundleFilesValidator.java:112) 在com.android.tools.build.bundletool.validation.ValidatorRunner.validateBundleModulesUsingSubValidator(ValidatorRunner.java:81)处 在com.android.tools.build.bundletool.validation.ValidatorRunner.lambda $ validateBundleModules $ 4(ValidatorRunner.java:64) 在com.google.common.collect.ImmutableList.forEach(ImmutableList.java:406) 在com.android.tools.build.bundletool.validation.ValidatorRunner.validateBundleModules(ValidatorRunner.java:63) 在com.android.tools.build.bundletool.validation.BundleModulesValidator.validate(BundleModulesValidator.java:101) 在com.android.tools.build.bundletool.commands.BuildBundleCommand.validateInput(BuildBundleCommand.java:244) 在com.android.tools.build.bundletool.commands.BuildBundleCommand.execute(BuildBundleCommand.java:162) 在com.android.build.gradle.internal.tasks.BundleTask $ BundleToolRunnable.run(BundleTask.kt:201) 在com.android.ide.common.workers.ExecutorServiceAdapter $ submit $ submission $ 1.run(ExecutorServiceAdapter.kt:39) 在java.util.concurrent.ForkJoinTask $ AdaptedRunnableAction.exec(ForkJoinTask.java:1386) 在java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) 在java.util.concurrent.ForkJoinTask.externalInterruptibleAwaitDone(ForkJoinTask.java:361) 在java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1001) ...还有53个
manifest.xml is below
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.droidoxy.easymoneyrewards">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- AdxmiSdk Permission -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions"/>
<permission
android:name="com.droidoxy.easymoneyrewards.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.droidoxy.easymoneyrewards.permission.C2D_MESSAGE" />
<!-- This app has permission to register and receive data message. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- Below is optional -->
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:name="com.droidoxy.easymoneyrewards.app.App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.droidoxy.easymoneyrewards.AppActivity"
android:configChanges="keyboardHidden|orientation"
android:label="@string/app_name"
android:theme="@style/AppLTheme"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.droidoxy.easymoneyrewards.LoginActivity"
android:configChanges="keyboardHidden|orientation"
android:label="@string/title_activity_login"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.droidoxy.easymoneyrewards.SignupActivity"
android:configChanges="keyboardHidden|orientation"
android:label="@string/title_activity_sign_up"
android:screenOrientation="portrait" >
</activity>
<activity android:name=".IntroActivity"
android:theme="@style/AppTheme.NoActionBar"
android:label="Intro Activity">
</activity>
<activity
android:name="com.droidoxy.easymoneyrewards.MainActivity"
android:theme="@style/AppLTheme"
android:label="@string/app_name" >
</activity>
<activity
android:name="com.droidoxy.easymoneyrewards.EarningHistoryActivity"
android:label="@string/app_name" >
</activity>
<activity
android:name="com.droidoxy.easymoneyrewards.RedeemHistoryActivity"
android:label="@string/app_name" >
</activity>
<activity android:name="com.droidoxy.easymoneyrewards.RecoveryActivity" >
</activity>
<activity
android:name="com.droidoxy.easymoneyrewards.RedeemActivity"
android:label="@string/app_name" >
</activity>
<activity
android:name="com.droidoxy.easymoneyrewards.InstructionsActivity"
android:label="@string/app_name" >
</activity>
<activity
android:name="com.droidoxy.easymoneyrewards.AboutActivity"
android:label="@string/app_name" >
</activity>
<activity
android:name="com.droidoxy.easymoneyrewards.ReferActivity"
android:label="@string/app_name" >
</activity>
<activity
android:name="com.droidoxy.easymoneyrewards.ErrorActivity"
android:label="Internet disConnected" >
</activity>
<!-- This activity is the activity that will be launched by the alarm -->
<!-- Necessary components that SuperSonic / Ironsource needs-->
<activity
android:name="com.ironsource.sdk.controller.ControllerActivity"
android:configChanges="orientation|screenSize"
android:hardwareAccelerated="true" />
<activity
android:name="com.ironsource.sdk.controller.InterstitialActivity"
android:configChanges="orientation|screenSize"
android:hardwareAccelerated="true"
android:theme="@android:style/Theme.Translucent" />
<activity
android:name="com.ironsource.sdk.controller.OpenUrlActivity"
android:configChanges="orientation|screenSize"
android:hardwareAccelerated="true"
android:theme="@android:style/Theme.Translucent" />
<activity
android:name="com.playerize.superrewards.activities.SRWebViewActivity"
android:screenOrientation="portrait"
/>
<!-- Necessary components that AdxmiSDK needs -->
<activity
android:name="net.adxmi.android.AdBrowser"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.Light.NoTitleBar" >
</activity>
<service
android:name="net.adxmi.android.AdService"
android:exported="false" >
</service>
<!-- Optional components that AdxmiSDK needs -->
<receiver android:name="net.adxmi.android.AdReceiver" >
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
<data android:scheme="package" />
</intent-filter>
</receiver>
<!-- Component that rewarded ADs needs -->
<service
android:name="net.adxmi.android.ExpService"
android:exported="false" >
</service>
<!-- WhiteMobi Components -->
<activity android:name="com.white.mobi.sdk.WMOfferWall"/>
<!-- Component that firebase needs -->
<service android:name=".MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name=".MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<!--Component that paly video ADs needs-->
<activity
android:name="net.adxmi.android.video.VideoActivity"
android:configChanges="keyboard|keyboardHidden|screenSize|orientation"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar" >
</activity>
<!-- Include the AdActivity configChanges and theme. -->
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
<!-- the libraries that google play service configuration need to use -->
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<!-- Nativex Comnponents-->
<activity
android:name="com.nativex.monetization.activities.InterstitialActivity"
android:configChanges="orientation|screenSize"
android:hardwareAccelerated="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
/>
<activity
android:name="com.nativex.videoplayer.VideoActivity"
android:configChanges="orientation|screenSize" />
<!-- END Nativex Comnponents -->
<!-- Facebook components -->
<meta-data android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id"/>
<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name" />
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="@string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
<!-- END Facebook components -->
</application>
</manifest>
build.gradle 项目
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle应用
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.xx.xx"
minSdkVersion 15
targetSdkVersion 27
versionCode 20
versionName "2.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
// Maven Repositories
repositories {
google()
mavenCentral()
flatDir { dirs 'libs' }
maven { url "https://dl.bintray.com/ironsource-mobile/android-sdk" }
maven { url "https://bitbucket.org/adscend/androidsdk/raw/master/" }
maven { name "Fyber's maven repo"
url "https://fyber.bintray.com/maven" }
}
dependencies {
// test Libraries
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
// Android Support Libraries
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:mediarouter-v7:27.1.1'
implementation 'com.android.support:support-vector-drawable:27.1.1'
// Adnetwork Libraries
implementation 'com.fyber:fyber-sdk:8.19.0'
implementation(name: 'adgatemediasdk', ext: 'aar')
implementation(name: 'OfferToroSdk-v3.1.10', ext: 'aar')
implementation 'com.adscendmedia.sdk:adscendmedia:2.3.4'
implementation 'com.ironsource.sdk:mediationsdk:6.7.4@jar'
// MultiDex Dependency
implementation 'com.android.support:multidex:1.0.3'
// Other Libraries
implementation 'com.squareup.okio:okio:1.14.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.github.d-max:spots-dialog:0.7@aar'
implementation 'com.github.paolorotolo:appintro:4.1.0'
implementation 'org.apache.httpcomponents:httpclient-android:4.3.5'
implementation 'com.facebook.network.connectionclass:connectionclass:1.0.1'
// Facebook Login only
implementation 'com.facebook.android:facebook-login:4.36.0'
// slider library
implementation 'com.daimajia.slider:library:1.1.5@aar'
// Google Libraries
implementation 'com.google.android.gms:play-services-gcm:16.0.0'
implementation 'com.google.android.gms:play-services-ads:17.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-analytics:16.0.4'
// Firebase
implementation 'com.google.firebase:firebase-ads:17.0.0'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
}
apply plugin: 'com.google.gms.google-services'
答案 0 :(得分:0)
我通过在 build.gradle中添加PackagingOptions解决了我的类似错误。
您还可以尝试在build.gradle中添加以下行:
android {
...
packagingOptions {
exclude 'res/drawable/sr_list_item_background.xml'
}
}
我认为这应该可以解决问题。
原因::我不确定,但我猜想它会在构建捆绑包时删除此特定文件。
让我知道是否有帮助。