Closed jumpbayern closed 1 year ago
@jumpbayern can this be reproduced even after a clean build?
@mikepenz Yes. The same behaviour exists after a clean build.
@jumpbayern could you please provide a sample app to reproduce this? (Testing the sample app as part of this project with 7.3.0 and this does not show this issue.)
It sounds like there may be some build cache scenario/problem, which should be resolved with a full clean build of the project.
@mikepenz I have done the following:
After I build the app again, the .json file is still created without content.
Would it be possible to provide a sample app please, as it will be super hard to reproduce this without being able to reproduce.
Are there any log messages in the build? What happens if you run the export step manually with --info
flag?
./gradlew app:exportLibraryDefinitions -PaboutLibraries.exportPath=src/main/res/raw/ -PaboutLibraries.exportVariant=release --info
@mikepenz I have also just tested it with a new project. Somehow it is related to the cache. After the .json file has been generated once, it is not recreated.
Can you tell me what the problem is and how I can solve it?
Given that I can't reproduce it in the projects I have at hands, I have no answer to that question.
With new
project you reference to an android studio template?
Please provide a sample to possibly help to reproduce it and investigate more.
Just testing this plugin as a new user, I'm also seeing the same issue on AS 7.3.0.
{"metadata":{"generated":"2022-10-05T14:22:23.919Z"},"libraries":[],"licenses":{}}
Would it be possible to provide a sample app please on this or more information?
E.g. output of the log in info log level, which gradle version, the whole build environment, which plugins are being used.
What is the output of the action using some of the provided gradle tasks?
@mikepenz Hope this helps.
Android Studio Dolphin | 2021.3.1 Build #AI-213.7172.25.2113.9014738, built on August 31, 2022 Runtime version: 11.0.13+0-b1751.21-8125866 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 12.6
com.mikepenz.aboutlibraries.plugin : Version 10.5.0
gradle.properties
kotlin.code.style=official
org.gradle.configureondemand=true
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.vfs.watch=true
org.gradle.caching=true
org.gradle.jvmargs=-Xmx4096M -Dkotlin.daemon.jvm.options\="-Xmx4096M" -Dfile.encoding\=UTF-8 -XX:+UseParallelGC
android.useAndroidX=true
kapt.include.compile.classpath=false
android.enableJetifier=true
kapt.incremental.apt=true
android.jetifier.ignorelist=android-base-common,common
# disable buildConfig generation, speeds up build performance. Turn on in module if using this with:
# buildFeatures {
# buildConfig = true
# }
android.defaults.buildfeatures.buildconfig=false
# enable new kotlin caching
# https://blog.jetbrains.com/kotlin/2022/07/a-new-approach-to-incremental-compilation-in-kotlin/#how-to
kotlin.incremental.useClasspathSnapshot=true
# R8
# If you see issues with this turn it off.
android.enableR8.fullMode=true
# Enable rudimentary R class namespacing where each library only contains
# references to the resources it declares instead of declarations plus all transitive dependency references.
android.nonTransitiveRClass=true
# Generate the compile time only R class using the app's local resources
android.enableAppCompileTimeRClass=true
# We do this now, as in future AS versions these will be errors
android.r8.failOnMissingClasses = true
# Run 'aapt optimize' on resources to minimize their APK size impact.
android.enableResourceOptimizations=true
Output of task ./gradlew app:exportLibraryDefinitions -PaboutLibraries.exportPath=src/main/res/raw/ -PaboutLibraries.exportVariant=release
Configuration on demand is an incubating feature. Type-safe project accessors is an incubating feature.
Configure project :app WARNING:The option setting 'android.r8.failOnMissingClasses=true' is experimental. The current default is 'false'. WARNING:The option setting 'android.enableAppCompileTimeRClass=true' is experimental. The current default is 'false'. WARNING:The option setting 'android.jetifier.ignorelist=android-base-common,common' is experimental.
BUILD SUCCESSFUL in 3s 7 actionable tasks: 1 from cache, 6 up-to-date
I've re-ran we -info
which gives more clues.
Task name matched 'exportLibraryDefinitions'
Selected primary task 'app:exportLibraryDefinitions' from project :app
All projects evaluated.
Tasks to be executed: [task ':app:collectDependencies', task ':app:exportLibraryDefinitions']
Tasks that were excluded: []
Resolve mutations for :app:collectDependencies (Thread[Execution worker Thread 6,5,main]) started.
Resolve mutations for :app:collectDependencies (Thread[Execution worker Thread 6,5,main]) completed. Took 0.0 secs.
:app:collectDependencies (Thread[Execution worker Thread 9,5,main]) started.
> Task :app:collectDependencies UP-TO-DATE
Build cache key for task ':app:collectDependencies' is 28bcf0090ab8d7e7cb45293b1668442d
Skipping task ':app:collectDependencies' as it is up-to-date.
:app:collectDependencies (Thread[Execution worker Thread 9,5,main]) completed. Took 0.001 secs.
Resolve mutations for :app:exportLibraryDefinitions (Thread[Execution worker Thread 6,5,main]) started.
Resolve mutations for :app:exportLibraryDefinitions (Thread[Execution worker Thread 6,5,main]) completed. Took 0.0 secs.
:app:exportLibraryDefinitions (Thread[Execution worker Thread 9,5,main]) started.
producer locations for task group 0 (Thread[Execution worker Thread 6,5,main]) started.
producer locations for task group 0 (Thread[Execution worker Thread 6,5,main]) completed. Took 0.0 secs.
> Task :app:exportLibraryDefinitions UP-TO-DATE
Build cache key for task ':app:exportLibraryDefinitions' is 9e7562991fc67829af8b3714551f0e95
Skipping task ':app:exportLibraryDefinitions' as it is up-to-date.
:app:exportLibraryDefinitions (Thread[Execution worker Thread 9,5,main]) completed. Took 0.0 secs.
BUILD SUCCESSFUL in 3s
7 actionable tasks: 7 up-to-date
Also turning off gradle build-cache seems to have no effect.
> Task :app:exportLibraryDefinitions UP-TO-DATE
Caching disabled for task ':app:exportLibraryDefinitions' because:
Build cache is disabled
Skipping task ':app:exportLibraryDefinitions' as it is up-to-date.
:app:exportLibraryDefinitions (Thread[Execution worker Thread 6,5,main]) completed. Took 0.002 secs.
Task is still reported as up-to-date.
@wezley98 thanks for providing these. Started a fresh application, and applied exactly your gradle.properties
+ only added the plugin. And it works normally. 🤔
Is there anything else in your setup which may could result in a special behaviour? Any specific build variant or build flavor setup?
If you run ./gradlew findLibraries --info
will there be any additional info?
@mikepenz We have several variants or flavours in our project. The naming is then always as follows:
Could you possibly provide the rough configuration you apply for those variants / flavours? so I can try these out within the sample?
Hello @mikepenz,
sorry for the late reply.
I have added different ProductFlavors to your example. When you do this, .json files are created, but without content.
Thank you for providing the project. T
here must be something different happening. Opened the project. And just pressed the run button to install it in the emulator. Which would generate the respective json file below:
Did this on MacOS Ventura (and on 12.x before).
I'm having the same issue, I'm trying to understand what could cause it. Using gradle 7.6 worked, then I upgraded to gradle 8 and it failed but downgrading to 7.6 again still makes it fail.
@Tgo1014 thank you for the report. I have not had time to test Gradle 8. Any special log output which may indicate what happened? Could it be the gradle build cache?
Clearing my .gradle folder made it work. I tried once again to upgrade to 8.0 and I receive lots of this message when trying to run findLibraries
:
--> Retrieved no components for: com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.9
--> Retrieved no components for: com.squareup.okhttp3:okhttp-jvm:5.0.0-alpha.9
--> Retrieved no components for: com.squareup.okio:okio-jvm:3.1.0
--> Retrieved no components for: org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.20
...
It could be that Gradle 8 breaks the plugin. will need to investigate when I get time for it. Thanks for the report
I've found my issue!
I had org.gradle.unsafe.configuration-cache=true
. I realized this could be the culprit because at the end of the no components
list, it was displaying Configuration cache entry reused.
. Disabling this property made the build work even with Gradle 8.0.
Gaving the same issue as well when runniung the root task to exportLibraryDefinitions
Also
After updating the Android Gradle plugin from version 7.2.2 to 7.3.0, the .json file is created but there is no content in it.