Android_Studio给ApiCloud封装模块爬坑指南
1.官方文档
官方开发文档
2.报错,找不到资源
- 这个问题一定会让你疑惑满满的,原生调用一点问题都没有,为啥一到Apicloud 编译Android自定义Loader总是失败~并且打印出如下Log
2020-05-26 11:19:39
no manifest.xml, ignore
/uzmap/.gradle/caches/transforms-1/files-1.1/mylibrary-release.aar/fbca99d2f7d949fa86dd31c7091dc973/res/values/values.xml:192:5-195:13: AAPT: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.NoActionBar'.
/uzmap/.gradle/caches/transforms-1/files-1.1/mylibrary-release.aar/fbca99d2f7d949fa86dd31c7091dc973/res/values/values.xml:192:5-195:13: AAPT: No resource found that matches the given name: attr 'colorPrimary'.
/uzmap/.gradle/caches/transforms-1/files-1.1/mylibrary-release.aar/fbca99d2f7d949fa86dd31c7091dc973/res/values/values.xml:192:5-195:13: AAPT: No resource found that matches the given name: attr 'colorPrimaryDark'.
/uzmap/.gradle/caches/transforms-1/files-1.1/mylibrary-release.aar/fbca99d2f7d949fa86dd31c7091dc973/res/values/values.xml:196:5-93: AAPT: Error retrieving parent for item: No resource found that matches the given name 'ThemeOverlay.AppCompat.Dark.ActionBar'.
/uzmap/.gradle/caches/transforms-1/files-1.1/mylibrary-release.aar/fbca99d2f7d949fa86dd31c7091dc973/res/values/values.xml:197:5-83: AAPT: Error retrieving parent for item: No resource found that matches the given name 'ThemeOverlay.AppCompat.Light'.
/uzmap/temp/jil3ydqWpa9yW61/AStudioProject/app/build/intermediates/res/merged/release/values/values.xml:265: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.NoActionBar'.
/uzmap/temp/jil3ydqWpa9yW61/AStudioProject/app/build/intermediates/res/merged/release/values/values.xml:266: error: Error: No resource found that matches the given name: attr 'colorPrimary'.
/uzmap/temp/jil3ydqWpa9yW61/AStudioProject/app/build/intermediates/res/merged/release/values/values.xml:267: error: Error: No resource found that matches the given name: attr 'colorPrimaryDark'.
/uzmap/temp/jil3ydqWpa9yW61/AStudioProject/app/build/intermediates/res/merged/release/values/values.xml:269: error: Error retrieving parent for item: No resource found that matches the given name 'ThemeOverlay.AppCompat.Dark.ActionBar'.
/uzmap/temp/jil3ydqWpa9yW61/AStudioProject/app/build/intermediates/res/merged/release/values/values.xml:270: error: Error retrieving parent for item: No resource found that matches the given name 'ThemeOverlay.AppCompat.Light'.
Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)
at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)
at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:285)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing process /opt/Sdk/build-tools/28.0.3/aapt with arguments {package -f --no-crunch -I /opt/Sdk/platforms/android-28/android.jar -M /uzmap/temp/jil3ydqWpa9yW61/AStudioProject/app/build/intermediates/manifests/full/release/AndroidManifest.xml -S /uzmap/temp/jil3ydqWpa9yW61/AStudioProject/app/build/intermediates/res/merged/release -m -J /uzmap/temp/jil3ydqWpa9yW61/AStudioProject/app/build/generated/source/r/release -F /uzmap/temp/jil3ydqWpa9yW61/AStudioProject/app/build/intermediates/res/release/resources-release.ap_ --custom-package com.lovewysy.bds -0 apk --output-text-symbols /uzmap/temp/jil3ydqWpa9yW61/AStudioProject/app/build/intermediates/symbols/release --no-version-vectors}
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:794)
... 41 more
Caused by: com.android.ide.common.process.ProcessException: Error while executing process /opt/Sdk/build-tools/28.0.3/aapt with arguments {package -f --no-crunch -I /opt/Sdk/platforms/android-28/android.jar -M /uzmap/temp/jil3ydqWpa9yW61/AStudioProject/app/build/intermediates/manifests/full/release/AndroidManifest.xml -S /uzmap/temp/jil3ydqWpa9yW61/AStudioProject/app/build/intermediates/res/merged/release -m -J /uzmap/temp/jil3ydqWpa9yW61/AStudioProject/app/build/generated/source/r/release -F /uzmap/temp/jil3ydqWpa9yW61/AStudioProject/app/build/intermediates/res/release/resources-release.ap_ --custom-package com.lovewysy.bds -0 apk --output-text-symbols /uzmap/temp/jil3ydqWpa9yW61/AStudioProject/app/build/intermediates/symbols/release --no-version-vectors}
at com.android.build.gradle.internal.process.GradleProcessResult.buildProcessException(GradleProcessResult.java:73)
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:48)
at com.android.builder.internal.aapt.AbstractProcessExecutionAapt$1.onSuccess(AbstractProcessExecutionAapt.java:78)
at com.android.builder.internal.aapt.AbstractProcessExecutionAapt$1.onSuccess(AbstractProcessExecutionAapt.java:74)
at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1237)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:911)
at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:822)
at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:664)
at com.google.common.util.concurrent.SettableFuture.set(SettableFuture.java:48)
at com.android.build.gradle.internal.process.GradleProcessExecutor$1.run(GradleProcessExecutor.java:58)
Caused by: org.gradle.process.internal.ExecException: Process 'command '/opt/Sdk/build-tools/28.0.3/aapt'' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:380)
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:46)
... 9 more
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processReleaseResources'.
> Failed to execute aapt
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 13s
解决思路 https://blog.csdn.net/xiayiye5/article/details/81304951
感谢前辈的摸索。意思是要复制 appcompat-v7-25.0.0.aar和 support-vector-drawable-25.0.0.aar这两个文件到你的打包文件夹中~这个25.0.0版本代号要和你的Android Studio V7的版本号一致!
3.原生调用moudle测试也会报错~
当我们封装之前,一般会进行原生调用的测试,当然测试的时候会注释掉如下一些代码
- 引用
// provided files('../test/libs/apiEngine v1.1.0.jar')
-
类
// public class MyAPIModule extends UZModule {
// ...
// }
此时运行还是错误的话,你要考虑下你们是否有第三方 **.SO**文件,当有第三方的 **.SO**文件的时候,请把相关的文件拷贝到被调用的moudle里,即主moudle中~
##### 4.作为Library的moudle注意事项
当我们是新建的请忽略,如New-----Moudle-----Android Library这样生成的,当我们使用普通moudle修改为Library时候,请注意:
* build.gradle
```java
apply plugin: 'com.android.library'
-
AndroidManifest.xml
application中无须多写其他参数;
activity无须其他启动参数
- 正确写法示意
5.Apicloud编译注意事项
- 可以改下固件版本
开发控制台————端开发————云编译————高级设置
进行修改~
- 自定义模块记得按加号添加进项目
- 自定义loader记得勾选,使用升级环境编译
- 调试代码要先安装loader