adwiv / android-fat-aar Goto Github PK
View Code? Open in Web Editor NEWGradle script that allows you to merge and embed dependencies in generted aar file
License: The Unlicense
Gradle script that allows you to merge and embed dependencies in generted aar file
License: The Unlicense
I'm faced with 'small' problem. When I try build (assembleRelease) my library with (or not) enabled proguard configuration, the build process throws an exception because of some warnings. But I can't fix this issue from my own project, I need download your android-fat-aar.gradle file and edit by myself just adding the below code snippet on generateXClass method:
task generateXClass(type: ProGuardTask, dependsOn: generateRClass) {
delete(post_r2x_dir)
println generateXClass
injars pree_r2x_dir, filter: '!**/R.java'
outjars post_r2x_dir
libraryjars android.getBootClasspath()
libraryjars libraryPaths
dontshrink
dontoptimize
dontpreverify
dontwarn 'my.package.**' <<<
dontwarn '**.R'
dontwarn '**.R$*'
keep 'class !**.R {*;}'
keep 'class !**.R$* {*;}'
applymapping "$base_r2x_dir/mapping-r.txt"
printmapping "$base_r2x_dir/mapping.txt"
printconfiguration "$base_r2x_dir/config.txt"
}
I believe that you can add a config file to create a way of to configure your internal proguard. Or I'm wrong and already exists a right way to do this?
Thanks in advance!
embedded project('io.socket:socket.io-client:0.7.0'), added this to my module dependencies, this is not being added to the aar
Seeing this error:
Error:(29, 0) Project with path 'io.socket:socket.io-client:0.7.0' could not be found in project ':test'
Please let me know if this is not the right approach
Thanks in advance
I´m using proguard in my modules.
As my project is a library, I´m using
release {
consumerProguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
But proguard configurations of my sub-modules are not included in the core library after compiling
It appears that this script does not properly handle resource IDs from multiple AARs.
I have an AAR that contains activities that require resources packaged in that AAR. All resources are referenced using R class from library's package name (com.first.library.R). Next, I have a second AAR which has its own activities and resources that are referenced via com.second.library.R and this AAR also needs first AAR (it calls its activities). This second library uses android-fat-aar script to build a fat AAR.
After fat AAR is built, it is imported in test application (application references AAR directly, it does not reference any of the library projects). Test application can be correctly built and can run on device/emulator. However, when an activity from first AAR is accessed, app crashes with java.lang.NoClassDefFoundError: Failed resolution of: Lcom/first/library/R$layout;
. It appears that final APK does not have R class from first AAR available.
Can this be fixed?
If required, I can provide two sample projects that reconstruct the issue.
Hi Adwiv,
I have custom libraries packaged as aar that I'd like to include in my fat aar. Is this supported by this script?
Thanks,
Fernando
BUILD FAILED
Error:Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
Where:
Script 'https://raw.githubusercontent.com/roremeol/android-fat-aar/master/fat-aar.gradle' line: 356
What went wrong:
Execution failed for task ':{module}:embedManifests'.
java.io.FileNotFoundException: /..../AndroidManifest.orig.xml (No such file or directory)
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Fix
The Android Studio 2.3 with Gradle 3.3 has changed the $bundle_release_dir: $build_dir/intermediates/bundles/release -> $build_dir/intermediates/bundles/default
The fix is to replace $bundle_release_dir path to "$build_dir/intermediates/bundles/default" (fat-aar.gradle, line #81)
my gradle version is gradle-2.14.1, jdk is 1.8.0_102, classpath 'com.android.tools.build:gradle:2.2.0'
,running an "assembleRelease" leads to this result:
Error:groovy.lang.GroovyRuntimeException: Could not find matching constructor for: com.android.ide.common.res2.ResourceSet(java.lang.String)
at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1726)
at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1529)
at org.codehaus.groovy.runtime.InvokerHelper.invokeConstructorOf(InvokerHelper.java:948)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.newInstance(DefaultGroovyMethods.java:15626)
at org.codehaus.groovy.runtime.dgm$447.doMethodInvoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.invoke(StaticMetaMethodSite.java:46)
at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.call(StaticMetaMethodSite.java:91)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at fat_aar_7k4i594lj9yi74rhiu5snd2te$_getMergedInputResourceSets_closure11.doCall(F:\5.5.0\CmbBugFinder\app\fat-aar.gradle:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)
at groovy.lang.Closure.call(Closure.java:426)
at groovy.lang.Closure.call(Closure.java:442)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2030)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2015)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2056)
at org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at fat_aar_7k4i594lj9yi74rhiu5snd2te.getMergedInputResourceSets(F:\5.5.0\CmbBugFinder\app\fat-aar.gradle:137)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:384)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
at fat_aar_7k4i594lj9yi74rhiu5snd2te$_run_closure4$_closure13.doCall(F:\5.5.0\CmbBugFinder\app\fat-aar.gradle:126)
at fat_aar_7k4i594lj9yi74rhiu5snd2te$_run_closure4$_closure13.doCall(F:\5.5.0\CmbBugFinder\app\fat-aar.gradle)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)
at groovy.lang.Closure.call(Closure.java:426)
at groovy.lang.Closure.call(Closure.java:420)
at org.gradle.util.GUtil.uncheckedCall(GUtil.java:401)
at org.gradle.api.internal.ConventionAwareHelper$2.getValue(ConventionAwareHelper.java:84)
at org.gradle.api.internal.ConventionAwareHelper$MappedPropertyImpl.getValue(ConventionAwareHelper.java:133)
at org.gradle.api.internal.ConventionAwareHelper.getConventionValue(ConventionAwareHelper.java:111)
at com.android.build.gradle.tasks.MergeResources_Decorated.getInputResourceSets(Unknown Source)
at com.android.build.gradle.tasks.MergeResources.getRawInputFolders(MergeResources.java:106)
at com.android.build.gradle.tasks.MergeResources_Decorated.getRawInputFolders(Unknown Source)
at sun.reflect.GeneratedMethodAccessor125.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$PropertyInfo$4.create(AnnotationProcessingTaskFactory.java:457)
at org.gradle.util.SingleMessageLogger.whileDisabled(SingleMessageLogger.java:171)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$PropertyInfo.getValue(AnnotationProcessingTaskFactory.java:455)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$Validator.validate(AnnotationProcessingTaskFactory.java:278)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:41)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.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:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
FAILURE: Build failed with an exception.
I noticed, that if you have a proguard file ending with no empty line, the first line of your other proguard file gets appended into the same line.
So you basically will have two proguard options in one line as a result
Error:Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
FAILURE: Build failed with an exception.
Where:
Script '*****\fat-aar.gradle' line: 294
What went wrong:
Execution failed for task ':myproject:generateRJava'.
*****\build\fat-aar\release\mapping-r.txt (The system cannot find the path specified)
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
When use proguard, it would be better to leave the jars in the libs directory, rather than merge them into classes.jar in the aar.
Because when we provide the aar, and the users use the same jar with another version , he can replace them as follow:
compile(name: 'mylib', ext: 'aar') {
exclude group: 'com.android.support', module: 'support-v4'
}
When users use proguard, they can use as follow:
-libraryjars libs/log4j.jar
ps , please forgive my bad English.
Hi,
I'm embedding this module in the library but when I import my aar library to my application, it throw this error.
I tried opening the aar file as an archive and under the module namespace, there is the R$ resources classes but doesn't have other java classes. Does fat aar include the java classes of the module?
I'm sorry about this issue, I modify the script without noticing that the embedding of java classes is still embedding it to the default folder. Changed it.
After upgrading to Gradle 2.10 the following line:
embedJniLibs.mustRunAfter packageReleaseJniLibs
no longer compiles and causes an error in Android Studio. Have to comment it out to get the code to compile now
I have two library. I would like to embed library1 into library2. I follow the step to embed the library1 into library2. When I run task assembleRelease of library2, I've got Note: duplicate definition of library class [X]
for all classes in library1 and finally build fails.
what should I do to fix this problem?
Thanks
task ':amazonpayments:generateXClass'
Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary configuration failure takes precedence.
org.gradle.internal.event.ListenerNotificationException: Failed to notify project evaluation listener.
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:55)
at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy11.afterEvaluate(Unknown Source)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:510)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:90)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:47)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
at org.gradle.initialization.DefaultGradleLauncher$2.run(DefaultGradleLauncher.java:125)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:122)
at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Cause 1: java.lang.IllegalStateException: buildToolsVersion is not specified.
at com.google.common.base.Preconditions.checkState(Preconditions.java:176)
at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:606)
at com.android.build.gradle.BasePlugin$10$1.call(BasePlugin.java:572)
at com.android.build.gradle.BasePlugin$10$1.call(BasePlugin.java:569)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
at com.android.build.gradle.BasePlugin$10.execute(BasePlugin.java:568)
at com.android.build.gradle.BasePlugin$10.execute(BasePlugin.java:565)
at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:93)
at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:82)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy11.afterEvaluate(Unknown Source)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:510)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:90)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:47)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
at org.gradle.initialization.DefaultGradleLauncher$2.run(DefaultGradleLauncher.java:125)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:122)
at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Cause 2: groovy.lang.MissingPropertyException: Could not find property 'generateReleaseAssets' on project ':amazonpayments'.
at org.gradle.api.internal.AbstractDynamicObject.propertyMissingException(AbstractDynamicObject.java:43)
at org.gradle.api.internal.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:35)
at org.gradle.api.internal.CompositeDynamicObject.getProperty(CompositeDynamicObject.java:97)
at org.gradle.groovy.scripts.BasicScript.propertyMissing(BasicScript.java:66)
at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaClassImpl.invokeMissingProperty(MetaClassImpl.java:877)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1856)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3737)
at groovy.lang.GroovyObjectSupport.getProperty(GroovyObjectSupport.java:38)
at groovy.lang.Script.getProperty(Script.java:58)
at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:172)
at groovy.lang.Closure.getPropertyTryThese(Closure.java:324)
at groovy.lang.Closure.getPropertyOwnerFirst(Closure.java:318)
at groovy.lang.Closure.getProperty(Closure.java:307)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:50)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:307)
at fat_aar_fax2u3o0pwrmfqle1o1aw8kw$_run_closure3.doCall(https://raw.githubusercontent.com/adwiv/android-fat-aar/master/fat-aar.gradle:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)
at groovy.lang.Closure.call(Closure.java:426)
at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40)
at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy11.afterEvaluate(Unknown Source)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:510)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:90)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:47)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
at org.gradle.initialization.DefaultGradleLauncher$2.run(DefaultGradleLauncher.java:125)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:122)
at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
FAILURE: Build failed with an exception.
* Where:
Script 'https://raw.githubusercontent.com/adwiv/android-fat-aar/master/fat-aar.gradle' line: 312
* What went wrong:
A problem occurred evaluating script.
* android.compileSdkVersion is missing!
I geting this error when I try to sync gradle. It began to appear after I update Android Studio. Any ideas?
Dear fat-aar team,
when i use the library in an app that uses the gradle-experimental plugin, the gradle build crashes. As i use the library a lot i would love to get support for the gradle-experimental plugin.
Thanks!
ndk {
abiFilters "armeabi"
}
This configuration is invalid。
release aar has all so。
In some environments the jni libs were not being included in my output aar. This was happening when "transformNative_libsWithSyncJniLibsForRelease" was not UP_TO_DATE.
I was able to work around this by ensuring that "embedJniLibs" ran after "transformNative_libsWithSyncJniLibsForRelease".
I didn't dig to much further into the issue.
i follow your tips,embedded in library and compile the library in app
gradle show this:
Error:FAILURE: Build failed with an exception.
Where:
Script 'H:\android_project\BaseRecyclerViewAdapterHelper-master\alibrary\fat-aar.gradle' line: 218
What went wrong:
Execution failed for task ':alibrary:generateRJava'.
H:\android_project\BaseRecyclerViewAdapterHelper-master\alibrary\build\intermediates\exploded-aar\BaseRecyclerViewAdapterHelper-master\blibrary\unspecified\AndroidManifest.xml (系统找不到指定的路径。)
First of all thanks for your work
I try to use embedded project(':EAPI') where is EAPI is my Java module and it fails on parsing of AndroidManifest file because java project doesn't have it.
I think it is great idea to add this functionality
Logs:
FAILURE: Build failed with an exception.
* Where:
Script '/Users/vitalii_lebedynskyi/Projects/MyProject/mainModule/fat-aar.gradle' line: 234
* What went wrong:
Execution failed for task ':sdk:embedRClassFiles'.
> /Users/vitalii_lebedynskyi/Projects/MyProject/mainModule/sdk/build/intermediates/exploded-aar/com.package.eapi/EAPI/1.00/AndroidManifest.xml (No such file or directory)
Hi,
I have my own library, which I want to embed inside a third party library.
When using fat-aar, they get the following error:
error: cannot find symbol variable common_google_play_services_install_text
Gradle version used: 2.14.1
It think that it has to do with the fact that both libraries use Google Play Services, but different components of it.
In my library I have the following dependency:
compile 'com.google.android.gms:play-services-location:+'
And in the destination library, they have the following dependency:
compile 'com.google.android.gms:play-services-ads:9.0.2'
Their build file looks like this:
apply from: 'https://raw.githubusercontent.com/adwiv/android-fat-aar/master/fat-aar.gradle'
and
embedded project(':tingzlibrary-1.5a')
tingzlibrary is the name of my library.
In 1.2.3, it appears there is no proguardRelease task. I commented this out as I'm not using proguard at this stage, but FYI.
Hi
I use gradle 2.5 and fat-aar spits the exception below. Which version of gradle is supported?
groovy.lang.MissingPropertyException: Could not find property 'generateReleaseAssets' on project ':api-impl'.
at org.gradle.api.internal.AbstractDynamicObject.propertyMissingException(AbstractDynamicObject.java:43)
at org.gradle.api.internal.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:35)
at org.gradle.api.internal.CompositeDynamicObject.getProperty(CompositeDynamicObject.java:97)
at org.gradle.groovy.scripts.BasicScript.propertyMissing(BasicScript.java:66)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaClassImpl.invokeMissingProperty(MetaClassImpl.java:873)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1852)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3689)
at groovy.lang.GroovyObjectSupport.getProperty(GroovyObjectSupport.java:36)
at groovy.lang.Script.getProperty(Script.java:56)
at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:168)
at groovy.lang.Closure.getPropertyTryThese(Closure.java:321)
at groovy.lang.Closure.getPropertyOwnerFirst(Closure.java:315)
at groovy.lang.Closure.getProperty(Closure.java:304)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
The Task.leftShift(Closure) method has been deprecated and is scheduled to be
removed in Gradle 5.0. Please use Task.doLast(Action) instead.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
ModuleDependency.getConfiguration() has been deprecated and is scheduled to be
removed in Gradle 4.0. Use ModuleDependency.getTargetConfiguration() instead.
Can upgrade this code to new version?
apply from: 'https://raw.githubusercontent.com/adwiv/android-fat-aar/master/fat-aar.gradle'
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.1'
testCompile 'junit:junit:4.12'
embedded project(':libcamera-release')
embedded project(':libcommon-release')
embedded project(':libidcardcaptor-release')
embedded project(':libimagecapture-release')
embedded project(':liblivenessdetectionview2-release')
embedded project(':liblivenessdetector2-release')
embedded project(':olivelibrary')
}
groovy.lang.GroovyRuntimeException: Could not find matching constructor for: com.android.ide.common.res2.ResourceSet(java.lang.String)
at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1726)
at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1529)
at org.codehaus.groovy.runtime.InvokerHelper.invokeConstructorOf(InvokerHelper.java:948)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.newInstance(DefaultGroovyMethods.java:15626)
at org.codehaus.groovy.runtime.dgm$447.doMethodInvoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.invoke(StaticMetaMethodSite.java:46)
at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.call(StaticMetaMethodSite.java:91)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at fat_aar_fax2u3o0pwrmfqle1o1aw8kw$_getMergedInputResourceSets_closure11.doCall(https://raw.githubusercontent.com/adwiv/android-fat-aar/master/fat-aar.gradle:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)
at groovy.lang.Closure.call(Closure.java:426)
at groovy.lang.Closure.call(Closure.java:442)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2030)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2015)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2056)
at org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at fat_aar_fax2u3o0pwrmfqle1o1aw8kw.getMergedInputResourceSets(https://raw.githubusercontent.com/adwiv/android-fat-aar/master/fat-aar.gradle:137)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:384)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
at fat_aar_fax2u3o0pwrmfqle1o1aw8kw$_run_closure4$_closure13.doCall(https://raw.githubusercontent.com/adwiv/android-fat-aar/master/fat-aar.gradle:126)
at fat_aar_fax2u3o0pwrmfqle1o1aw8kw$_run_closure4$_closure13.doCall(https://raw.githubusercontent.com/adwiv/android-fat-aar/master/fat-aar.gradle)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)
at groovy.lang.Closure.call(Closure.java:426)
at groovy.lang.Closure.call(Closure.java:420)
at org.gradle.api.internal.ConventionAwareHelper$2.getValue(ConventionAwareHelper.java:84)
at org.gradle.api.internal.ConventionAwareHelper$MappedPropertyImpl.getValue(ConventionAwareHelper.java:136)
at org.gradle.api.internal.ConventionAwareHelper.getConventionValue(ConventionAwareHelper.java:114)
at com.android.build.gradle.tasks.MergeResources_Decorated.getInputResourceSets(Unknown Source)
at com.android.build.gradle.tasks.MergeResources.getRawInputFolders(MergeResources.java:106)
at com.android.build.gradle.tasks.MergeResources_Decorated.getRawInputFolders(Unknown Source)
at sun.reflect.GeneratedMethodAccessor236.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$PropertyInfo$4.create(AnnotationProcessingTaskFactory.java:458)
at org.gradle.util.SingleMessageLogger.whileDisabled(SingleMessageLogger.java:166)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$PropertyInfo.getValue(AnnotationProcessingTaskFactory.java:456)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$Validator.validate(AnnotationProcessingTaskFactory.java:277)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:41)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.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:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:46)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:58)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
FAILURE: Build failed with an exception.
when i updated to gradle 2.2.0 alpha4 i got this error ?
thank you in advance
It seems like turn on minifyEnabled
is not working, I'll get lot's of duplicate definition of library class
and the output class.jar lost most of the codes.
Hi,
I am testing the library with 'com.android.tools.build:gradle:2.2.1' and Gradle 3.1.
I created my fat aar containing an .aar library. But when I try to use my newly created fat .aar library I get an error on the resources.
When trying to embed a dependency project using fat-aar
the fat-aar
tasks are executed before the dependency project is finished building. This happens if the org.gradle.parallel
option is set to true
.
This can be prevented by making sure that fat-aar
tasks are always ran after prepareReleaseDenpendencies
task.
My fix:
embedAssets.mustRunAfter prepareReleaseDependencies
embedLibraryResources.mustRunAfter prepareReleaseDependencies
embedProguard.mustRunAfter prepareReleaseDependencies
copyJavaJars.mustRunAfter prepareReleaseDependencies
When I update to Android Studio 2.3, I met some errors. so I modify some codes.
/** * This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to */ import com.android.annotations.NonNull import com.android.manifmerger.ManifestMerger2 import com.android.manifmerger.ManifestMerger2.Invoker import com.android.manifmerger.ManifestMerger2.MergeType import com.android.manifmerger.MergingReport import com.android.manifmerger.PlaceholderEncoder import com.android.manifmerger.XmlDocument import com.android.utils.ILogger import com.google.common.base.Charsets import com.google.common.io.Files /** * Fat AAR Lib generator v 0.2.1 * Target Gradle Version :: 2.2.0 * * Latest version available at https://github.com/adwiv/android-fat-aar * Please report issues at https://github.com/adwiv/android-fat-aar/issues * * This code is in public domain. * * Use at your own risk and only if you understand what it does. You have been warned ! :-) */ buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:manifest-merger:25.2.0' } } configurations { embedded } dependencies { compile configurations.embedded } // Paths to embedded jar files ext.embeddedJars = new ArrayList() // Paths to embedded aar projects ext.embeddedAarDirs = new ArrayList() // List of embedded R classes ext.embeddedRClasses = new ArrayList() // Change backslash to forward slash on windows ext.build_dir = buildDir.path.replace(File.separator, '/'); ext.root_dir = project.rootDir.absolutePath.replace(File.separator, '/'); ext.exploded_aar_dir = "$build_dir/intermediates/exploded-aar"; ext.classs_release_dir = "$build_dir/intermediates/classes/release"; ext.manifest_aaapt_dir = "$build_dir/intermediates/manifests/aapt/release"; ext.generated_rsrc_dir = "$build_dir/generated/source/r/release"; ext.base_r2x_dir = "$build_dir/fat-aar/release/"; def apiVersionString project.rootProject.buildscript.configurations.classpath.each { if (it.name.contains("gradle-api")) apiVersionString = it.name } apiVersionString = apiVersionString.replace('gradle-api-', '').replace('.jar', ''); ext.gradleApiVersion = apiVersionString.substring(0, apiVersionString.lastIndexOf('.')).toFloat() if (gradleApiVersion >= 2.3f) { ext.taskTransformNativeLib = "transformNativeLibsWithSyncJniLibsForRelease" ext.bundle_release_dir = "$build_dir/intermediates/bundles/default"; } else { ext.taskTransformNativeLib = "transformNative_libsWithSyncJniLibsForRelease" ext.bundle_release_dir = "$build_dir/intermediates/bundles/release"; } afterEvaluate { // the list of dependency must be reversed to use the right overlay order. def dependencies = new ArrayList(configurations.embedded.resolvedConfiguration.firstLevelModuleDependencies) dependencies.reverseEach { def aarPath; if (gradleApiVersion >= 2.3f) aarPath = "${root_dir}/${it.moduleName}/build/intermediates/bundles/default" else aarPath = "${exploded_aar_dir}/${it.moduleGroup}/${it.moduleName}/${it.moduleVersion}" it.moduleArtifacts.each { artifact -> if (artifact.type == 'aar') { if (!embeddedAarDirs.contains(aarPath)) { embeddedAarDirs.add(aarPath) } } else if (artifact.type == 'jar') { def artifactPath = artifact.file if (!embeddedJars.contains(artifactPath)) embeddedJars.add(artifactPath) } else { throw new Exception("Unhandled Artifact of type ${artifact.type}") } } } if (dependencies.size() > 0) { // Merge Assets generateReleaseAssets.dependsOn embedAssets embedAssets.dependsOn prepareReleaseDependencies // Embed Resources by overwriting the inputResourceSets packageReleaseResources.dependsOn embedLibraryResources embedLibraryResources.dependsOn prepareReleaseDependencies // Embed JNI Libraries bundleRelease.dependsOn embedJniLibs embedJniLibs.dependsOn "$taskTransformNativeLib" // Merge Embedded Manifests bundleRelease.dependsOn embedManifests embedManifests.dependsOn processReleaseManifest // Merge proguard files embedLibraryResources.dependsOn embedProguard embedProguard.dependsOn prepareReleaseDependencies // Generate R.java files compileReleaseJavaWithJavac.dependsOn generateRJava generateRJava.dependsOn processReleaseResources // Bundle the java classes bundleRelease.dependsOn embedJavaJars embedJavaJars.dependsOn compileReleaseJavaWithJavac // If proguard is enabled, run the tasks that bundleRelease should depend on before proguard if (tasks.findByPath('proguardRelease') != null) { proguardRelease.dependsOn embedJavaJars } else if (tasks.findByPath('transformClassesAndResourcesWithProguardForRelease') != null) { transformClassesAndResourcesWithProguardForRelease.dependsOn embedJavaJars } } } task embedLibraryResources << { println "Running FAT-AAR Task :embedLibraryResources" def oldInputResourceSet = packageReleaseResources.inputResourceSets packageReleaseResources.conventionMapping.map("inputResourceSets") { getMergedInputResourceSets(oldInputResourceSet) } } private List getMergedInputResourceSets(List inputResourceSet) { //We need to do this trickery here since the class declared here and that used by the runtime //are different and results in class cast error def ResourceSetClass = inputResourceSet.get(0).class List newInputResourceSet = new ArrayList(inputResourceSet) embeddedAarDirs.each { aarPath -> try { def resname if (gradleApiVersion >= 2.3f) { def parentProject = project.rootProject.name.toString() def startIndex = aarPath.indexOf('/' + parentProject) def endIndex = aarPath.indexOf('/build') if (startIndex < 1 || endIndex < 1) return; resname = aarPath.substring(startIndex, endIndex).replace('/', ':') } else resname = (aarPath.split(exploded_aar_dir)[1]).replace('/', ':'); def rs = ResourceSetClass.newInstance([resname, true] as Object[]) rs.addSource(file("$aarPath/res")) // println "ResourceSet is " + rs newInputResourceSet += rs } catch (Exception e) { e.printStackTrace(); throw e; } } return newInputResourceSet } /** * Assets are simple files, so just adding them to source set seems to work. */ task embedAssets << { println "Running FAT-AAR Task :embedAssets" embeddedAarDirs.each { aarPath -> // Merge Assets android.sourceSets.main.assets.srcDirs += file("$aarPath/assets") } } /** * Merge proguard.txt files from all library modules * @author Marian Klühspies */ task embedProguard << { println "Running FAT-AAR Task :embedProguard" def proguardRelease = file("$bundle_release_dir/proguard.txt") embeddedAarDirs.each { aarPath -> try { def proguardLibFile = file("$aarPath/proguard.txt") if (proguardLibFile.exists()) proguardRelease.append(proguardLibFile.text) } catch (Exception e) { e.printStackTrace(); throw e; } } } task generateRJava << { println "Running FAT-AAR Task :generateRJava" // Now generate the R.java file for each embedded dependency def libPackageName = new XmlParser().parse(android.sourceSets.main.manifest.srcFile).@package embeddedAarDirs.each { aarPath -> def aarManifest = new XmlParser().parse(file("$aarPath/AndroidManifest.xml")); def aarPackageName = aarManifest.@package String packagePath = aarPackageName.replace('.', '/') // Generate the R.java file and map to current project's R.java // This will recreate the class file def rTxt = file("$aarPath/R.txt") def rMap = new ConfigObject() if (rTxt.exists()) { rTxt.eachLine { line -> //noinspection GroovyUnusedAssignment def (type, subclass, name, value) = line.tokenize(' ') rMap[subclass].putAt(name, type) } } def sb = "package $aarPackageName;" << '\n' << '\n' sb << 'public final class R {' << '\n' rMap.each { subclass, values -> sb << " public static final class $subclass {" << '\n' values.each { name, type -> sb << " public static $type $name = ${libPackageName}.R.${subclass}.${name};" << '\n' } sb << " }" << '\n' } sb << '}' << '\n' mkdir("$generated_rsrc_dir/$packagePath") file("$generated_rsrc_dir/$packagePath/R.java").write(sb.toString()) embeddedRClasses += "$packagePath/R.class" embeddedRClasses += "$packagePath/R\$*.class" } } task collectRClass << { delete base_r2x_dir mkdir base_r2x_dir copy { from classs_release_dir include embeddedRClasses into base_r2x_dir } } task embedRClass(type: org.gradle.jvm.tasks.Jar, dependsOn: collectRClass) { destinationDir file("$bundle_release_dir/libs/") from base_r2x_dir } /** * To embed the class files, we need to change the R.class to X.class, so we explode it in another * location, proguard it to modify R to X, and then finally copy it to build location */ task embedJavaJars(dependsOn: embedRClass) << { println "Running FAT-AAR Task :embedJavaJars" embeddedAarDirs.each { aarPath -> // Explode all classes.jar files to classes so that they can be proguarded def jar_dir if (gradleApiVersion >= 2.3f) jar_dir = "$aarPath" else jar_dir = "$aarPath/jars" copy { from zipTree(jar_dir + "/classes.jar") into classs_release_dir } // Copy all additional jar files to bundle lib FileTree jars = fileTree(dir: jar_dir, include: '*.jar', exclude: 'classes.jar') jars += fileTree(dir: jar_dir + "/libs", include: '*.jar') jars += fileTree(dir: "$aarPath/libs", include: '*.jar') copy { from jars into file("$bundle_release_dir/libs") } // Copy all embedded jar files to bundle lib copy { from embeddedJars into file("$bundle_release_dir/libs") } } } /** * For some reason, adding to the jniLibs source set does not work. So we simply copy all files. */ task embedJniLibs << { println "Running FAT-AAR Task :embedJniLibs" embeddedAarDirs.each { aarPath -> println "======= Copying JNI from $aarPath/jni" // Copy JNI Folders copy { from fileTree(dir: "$aarPath/jni") into file("$bundle_release_dir/jni") } } } task embedManifests << { println "Running FAT-AAR Task :embedManifests" ILogger mLogger = new MiLogger() List libraryManifests = new ArrayList<>() embeddedAarDirs.each { aarPath -> if (!libraryManifests.contains(aarPath)) { libraryManifests.add(file("$aarPath/AndroidManifest.xml")) } } File reportFile = file("${build_dir}/embedManifestReport.txt") File origManifest = file("$bundle_release_dir/AndroidManifest.xml") File copyManifest = file("$bundle_release_dir/AndroidManifest.orig.xml") File aaptManifest = file("$manifest_aaapt_dir/AndroidManifest.xml") copy { from origManifest.parentFile into copyManifest.parentFile include origManifest.name rename(origManifest.name, copyManifest.name) } try { Invoker manifestMergerInvoker = ManifestMerger2.newMerger(copyManifest, mLogger, MergeType.APPLICATION) manifestMergerInvoker.addLibraryManifests(libraryManifests.toArray(new File[libraryManifests.size()])) // manifestMergerInvoker.setPlaceHolderValues(placeHolders) manifestMergerInvoker.setMergeReportFile(reportFile); MergingReport mergingReport = manifestMergerInvoker.merge(); mLogger.info("Merging result:" + mergingReport.getResult()); MergingReport.Result result = mergingReport.getResult(); switch (result) { case MergingReport.Result.WARNING: mergingReport.log(mLogger); // fall through since these are just warnings. case MergingReport.Result.SUCCESS: XmlDocument xmlDocument = mergingReport.getMergedXmlDocument(MergingReport.MergedManifestKind.MERGED); try { String annotatedDocument = mergingReport.getActions().blame(xmlDocument); mLogger.verbose(annotatedDocument); } catch (Exception e) { mLogger.error(e, "cannot print resulting xml"); } save(xmlDocument, origManifest); mLogger.info("Merged manifest saved to " + origManifest); if (aaptManifest.exists()) { new PlaceholderEncoder().visit(xmlDocument); save(xmlDocument, aaptManifest); mLogger.info("Merged aapt safe manifest saved to " + aaptManifest); } break; case MergingReport.Result.ERROR: mergingReport.log(mLogger); throw new RuntimeException(mergingReport.getReportString()); default: throw new RuntimeException("Unhandled result type : " + mergingReport.getResult()); } } catch (RuntimeException e) { // Unacceptable error e.printStackTrace() throw new RuntimeException(e); } } private void save(XmlDocument xmlDocument, File out) { try { Files.write(xmlDocument.prettyPrint(), out, Charsets.UTF_8); } catch (IOException e) { throw new RuntimeException(e); } } class MiLogger implements ILogger { @Override void error( @com.android.annotations.Nullable Throwable t, @com.android.annotations.Nullable String msgFormat, Object... args) { System.err.println(String.format("========== ERROR : " + msgFormat, args)) if (t) t.printStackTrace(System.err) } @Override void warning(@NonNull String msgFormat, Object... args) { System.err.println(String.format("========== WARNING : " + msgFormat, args)) } @Override void info(@NonNull String msgFormat, Object... args) { System.out.println(String.format("========== INFO : " + msgFormat, args)) } @Override void verbose(@NonNull String msgFormat, Object... args) { // System.out.println(String.format("========== DEBUG : " + msgFormat, args)) } }
com/android/utils/ILogger : Unsupported major.minor version 52.0
I am not able to use fat aar in my library project. Please find details of exception below:
Error:FAILURE: Build failed with an exception.
Where:
Script 'https://raw.githubusercontent.com/adwiv/android-fat-aar/master/fat-aar.gradle' line: 264
What went wrong:
Execution failed for task ':SmoothPlayerSDK:generateRJava'.
E:\MultiTvSDKDApp\MultiTvSDKDApp\SmoothPlayerSDK\build\fat-aar\release\mapping-r.txt (The system cannot find the path specified)
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I am using latest version of fat aar with android studio version 2.2
Hi Adwiv! I am an android sdk developer. This repo is really helpful.
However, it also has many limitation and cannot match some of requirement.
And it's hard to maintain as a gradle script. So I create a new repo with Gradle Plugin
.
Aim to make it more functional.
Here is fat-aar-plugin.
As a kind of manner, I added your repo to my Thanks
in the README.md
. And license mine with MIT. 😄
Hi!
I'm trying to use Android Studio to embed an .aar in my project. If I use java 8, everything works fine, but if I switch to java 7 I have this error:
Error: Could not find method collectDependencies() for arguments [yospace:yoAdManagement-release:unspecified;default] on project ':yospacewrapper' of type org.gradle.api.Project.
That dependency "yoAdManagement-release" is built against java 7.
This is yoAdManagement-release gradle:
configurations.maybeCreate("default")
artifacts.add("default", file('yoAdManagement-release.aar'))`
And this is the main project gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
apply from: 'fat-aar.gradle'
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
embedded project(':yoAdManagement-release')
}
}
Gradle version is 2.14.1
Thanks!
I had to switch compileReleaseJava to compileReleaseJavaWithJavac in 1.2.3, otherwise I got an unknown property.
Haven't tested with 1.3 yet.
Hi,
I am facing an issue when trying to assemble a release variant due to the generateRJava in fat-aar.gradle.
Below is the exception:
C:\Mobile 3.7 Android\testproj\build\generated\source\r\release\com\eye\R.java:1264: error: cannot find symbol
public static int Theme_popupMenuStyle = com.company.mobile.android.sdk.activity.R.styleable.Theme_popupMenuStyle;
^
symbol: variable Theme_popupMenuStyle
location: class styleable
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
100 errors
:testproj:compileReleaseJavaWithJavac FAILED
FAILURE: Build failed with an exception.
Compilation failed; see the compiler error output for details.
BUILD FAILED
I think that this might be because fat aar is generating the R.java for the aar's that I am trying to embed. This is creating the dependencies that are not being resolved.
Also when I comment out the code in generateRJava everything works fine.
Another observation, there are 2 aar's that we are trying to embed, one of them doesnt have a R.java file, I saw this when I opened the exploded AAR. Maybe this is causing some issue.
One more question:
In the below part of the code, the R.java is getting generated. This is where the project expects the variable that is in the aar to be in my project also. Why is this being done?
// Generate the R.java file and map to current project's R.java
// This will recreate the class file
def rTxt = file("$aarPath/R.txt")
def rMap = new ConfigObject()
if (rTxt.exists()) {
rTxt.eachLine {
line ->
//noinspection GroovyUnusedAssignment
def (type, subclass, name, value) = line.tokenize(' ')
rMap[subclass].putAt(name, type)
}
}
def sb = "package $aarPackageName;" << '\n' << '\n'
sb << 'public final class R {' << '\n'
rMap.each {
subclass, values ->
sb << " public static final class $subclass {" << '\n'
values.each {
name, type ->
sb << " public static $type $name = ${libPackageName}.R.${subclass}.${name};" << '\n'
}
sb << " }" << '\n'
}
sb << '}' << '\n'
I´m using fat-aar to merge six modules, which are forming my library I´m exporting. In addition, I have an application module in my project to test the library.
Error:Execution failed for task ':TestApp:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException:
com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException:
com.android.dex.DexException: Multiple dex files define Lcom/android/submodule/BuildConfig;
I was using an older fat-aar version before (0.1) I think, together with gradle 1.2.3 and build-tools 23.0.3, which worked perfectly. But with the current version of both my test application is unusable.
Has anyone experienced similar issues?
Hi
Your script so interesting and helpful.
Now I tried to embedded Facebook SDK into my library project (Export to .AAR file)
But seem like it's not also embedded resource file of Facebook SDK , is it ?
Because When I call Facebook's method that already merge in to my .AAR , error message at run time show up like this
java.lang.NoSuchFieldError: No static field Base_TextAppearance_AppCompat_Widget_PopupMenu_Header
Seem "Base_TextAppearance_AppCompat_Widget_PopupMenu_Header " is a style in facebook resouce. It's be love if you have any idea to fix this and share to me.
Thank for advance.
PS. In my gradle look like this
apply from: 'https://raw.githubusercontent.com/adwiv/android-fat-aar/master/fat-aar.gradle'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
**embedded 'com.facebook.android:facebook-android-sdk:4.+'**
compile 'com.google.firebase:firebase-core:9.6.1'
Hi, I am trying to package an AAR hiding all internal dependent jars that are published as maven artifact and your project is what all I need. It really rocks.
I am a newbie for Gradle and tried the following declaration:
dependencies {
embedded 'com.xxxx.project:apdf:1.0-SNAPSHOT'
embedded 'com.xxxx.project:android:2.0-SNAPSHOT'
embedded 'com.xxxx.project:native:1.0-SNAPSHOT@aar'
}
When running gradle build
, the project could be compiled but got:
* Where:
Script 'https://raw.githubusercontent.com/adwiv/android-fat-aar/master/fat-aar.gradle' line: 228
* What went wrong:
Execution failed for task ':embedRClassFiles'.
> /Users/tom.j/repo/noke/core/android/build/intermediates/exploded-aar/com.xxx.project/native/1.0-SNAPSHOT/AndroidManifest.xml (No such file or directory)
The AAR file used above is just a file packaged with native library files and does not include AndroidManifest.xml file.
Is it a bug or something wrong with my build file?
Thanks
In publish.gradle only contain ResolvedDependency
Map<String, ResolvedDependency> depList = new LinkedHashMap<>();
It doesn't contain exclude rules, how to I include those rules in my embedded modules?
Thanks.
Got a NPE on Gradle Plugin 1.5, see #10
when I use the fat-aar.gradle in my project,it reports: android.compileSdkVersion is missing!
`apply plugin: 'com.android.application'
apply plugin: 'checkstyle'
apply from: 'fat-aar.gradle'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"I have to put the apply statement below compileSdkVersion like
apply plugin: 'com.android.application'
apply plugin: 'checkstyle'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
apply from: 'fat-aar.gradle'
`
my android studio version is 2.2
changing archivesBaseName bring to multiple jars in library-v1.aar/libs/library-XX.jar
seems script include old/cached versions
@adwiv
When I use fat-aar.gradle
, it occurred this error: "unable to resolve class MergingReport.Result "
My project configuration:
HI,
First of all I would like to say this is a great project. So thank you.
I tried to use your project to solve the problem of creating an AAR that depends on two other AAR that will be a standalone (fatAAR).
At first I used the fat-aar.gradle as is but I noticed you are only copying the jar's and not the classes of the actual AAR.
I ended up adding them my self
jars += fileTree(dir: "$aarPath", include: ['*.jar']);
That did the trick for me.
I'm trying to understand how did the solution worked for you without this line?
Thanks again.
Ika.
def resname = (aarPath.split(exploded_aar_dir)[1]).replace('/', ':');
this line in the latest file "fat-aar.gradle" has the error in windows system :"the indexOutofBounds"
Reason is aarPath in windows has backslash character "".
while , the version before October 14 is ok. Please check submit files on October 14, and find which file's change causes the error.
Wait for your update, thks~
It seems that fat library's R.class is disappeared.
Error:FAILURE: Build failed with an exception.
Where:
Script 'https://raw.githubusercontent.com/adwiv/android-fat-aar/master/fat-aar.gradle' line: 114
What went wrong:
A problem occurred configuring project ':app'.
Could not get unknown property 'packageReleaseResources' for project ':app' of type org.gradle.api.Project.
apply from: 'https://raw.githubusercontent.com/adwiv/android-fat-aar/master/fat-aar.gradle'
dependencies {
embedded (project(':MyModule'))
'com.android.tools.build:gradle:2.2.2'
buildToolsVersion "25.0.0"
I had some issues while using the latest commit of the fat-aar.gradle file.
(commit 65cf9f7)
I was able to resolve some of these issues by inserting the following lines:
keepattributes 'InnerClasses'
dontwarn '**'
keep 'class ** {*;}'
keep 'interface ** {*;}'
in the task generateXClass
Essentially seems to happen is that now the script is using proguard when packing things up. Since my sub-library was using org.apache httpclient, the collision warning were causing failure (along with others too).
This sub-library is also requiring "com.mcxiaoke.volley:library:1.0.19@aar" and I am able to "embed" it.
However I need to use the Reponse.Listener interface:
http://afzaln.com/volley/com/android/volley/Response.Listener.html
With keep 'interface ** {*;}'
, it keeps the interface, but the gets stripped away.
My quick fix for now is to embed volley in my library instead of my sub-library, but I think this can be fixed with another proguard rule? When doing so all seems to work.
File not found X:\Something\build\intermediates\bundles\release\aapt\AndroidManifest.xml
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.