Gradle build failing - "A problem was found with the configuration of task ':app:generateSafeArgsDebug' (type 'ArgumentsGenerationTask')." - android

I'm trying to open and run the android architecture components sample project here: https://github.com/android/architecture-components-samples/tree/main/GithubBrowserSample in Android Studio. One one machine I'm able to get the project built and run just fine, but on my primary machine I'm seeing a build task error:
A problem was found with the configuration of task ':app:generateSafeArgsDebug' (type 'ArgumentsGenerationTask').
> No value has been specified for property 'enableGradleWorkers'.
I've tried the version of gradle and the gradle plugin that the project seems to have been built with, as well as the latest of each. I do have "android.enableGradleWorkers=true" specified in gradle.properties.
I haven't found this message when searching around, but I often see similar-looking errors when opening projects from different sources. I'd love to be able to fix this one, and ideally understand more about what to check when encountering build errors with projects from different sources in the future.

Related

Unity 2018.3 android dex merging issue

Before you decide to dismiss this post as "duplicate" without even reading it, understand that I have looked at a TON of posts related to this topic and I can't find a solution for my instance, including all of the ones that StackOverflow suggested. Most of the posts are for Android Studio instead of unity.
My error is given in Unity when trying to build to android, it crashes here.
CommandInvokationFailure: Gradle build failed.
C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\OpenJDK\Windows\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.6.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleDebug"
stderr[
D8: Program type already present: com.unity3d.ads.BuildConfig
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformDexArchiveWithExternalLibsDexMergerForDebug'.
I've tried changing stuff with a build.gradle file like a lot of posts suggest, but I can't get anything to work.
The error didn't exist in Unity 2018.2. I checked right before I updated, but the update is now throwing this issue.
Does anyone have any UNITY specific ideas what to do here? I've tried so many things and nobody's post has been able to help me yet.
Thanks for any help
You can open the PackageManage under Window in the menu bar and remove Advertisement or you can delete the com.unity.ads file of Library/PackageCache in the project directory to resolve this issue.
This error probably happens when you add a library which is not compatible with your compileSdkVersion.
In your case you can have libs that were not imported by default by unity (and now are)
or there can be a problem with the Build Tools version. (You can try updating them)
I had similar problem a few versions ago, but I don't remember how I fixed it.
I didn't have time to upgrade to unity 2018.3 yet. (So the tips are more like guesses, but it may help you solve the issue.)
My settings (Mac):
- Android Studio 2.3
- Unity 2019.1.5f1:
- Player Settings -> Other Settings –> Scripting Runtime Version = .Net 4
- Package Manager -> Advertisement: Uninstalled
- Preferences -> External Tools -> Android: checked Installed with Unity (everything)
My solution:
- delete GoogleMobileAds from project
- delete PlayServicesResolver from project
- delete Plugins from project
- Import Package -> Custom Package -> GoogleMobileAds.unitypackage (3.15.1 in my case)
Dex Errors generally occur when you have too many methods imported in a project, not because of a specific package. I assume upgrading to new version made you import new stuff to your project.
You need to enable ProGuard.
Cause: http://twinkfed.homedns.org/Android///tools/building/multidex.html
Fix: https://www.youtube.com/watch?v=va0FQNlBUX0

Delete unaligned apks using Gradle script in Android Studio 3.0?

After upgrading to Android Studio 3.0/build tools 3.0.0, a piece of my Gradle build script (which is used to delete unaligned apks after assembling) failed during build.
FYI I was using the Gradle scripts from this post.
Now it's always saying output.packageApplication.outputFile is an unknown property (Could not get unknown property 'outputFile' for task...).
I am wondering if there's an alternative way to get the unaligned file?
Any comment is appreciated, thanks in advance.
As of Gradle 2.2, there isn't an unaligned APK, so deleting it is unnecessary. (I just ran into this also - and noticed that they were missing.)
See the note here:
https://issuetracker.google.com/issues/37121010
So your code to remove them is unnecessary.
Also, to address the failure - as of Gradle 3.0 there are some features that are not working (like the variant outputFile). See the reference here on how to avoid that error:
https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#variant_api

Coutinous Integration of Xamarin Android

I'm recently working on automatic building of android in Xamarin. I came across some guides and discussion but couldn't find a solution yet.
I realized that the walkthrough in reference (1) guided to use mdtool on iOS, however, msbuild on android. This gives me the problem due to different project configuration in some project. For instance, project A has configuration "Debug", "Beta", "Release", however project B only has "Debug" and "Release", and project A is the startup project.
In the situation above, let's say I would like to build project A with configuration "Debug", is has no problem as the configuration would just pass to all dependant projects. The problem comes when building "Beta" configuration in Project A. There is no way for me to inform the MSBuild that please use "Release" for project B and a complaint was thrown from MSBuild.
Also, I tried to build individual project without by supplying flag of /p:BuildProjectReferences=false, it seems that the dependant project is still build and same error was thrown.
I think I almost out of solution here and looking for expert from here. Any helps are welcome, thank you~
Exact command used for build:
"%MS_BUILD_PATH%\MSBuild.exe" /t:PackageForAndroid /p:BuildProjectReferences=false /p:Configuration=Beta "%SOLUTION_PATH%\%SOLUTION_NAME%
Reference:
http://developer.xamarin.com/guides/cross-platform/ci/jenkins_walkthrough/
http://forums.xamarin.com/discussion/2114/create-apk-from-command-line

Gradle execution fails: Unknown command-line option '--daemon'

I use latest Android Studio (0.8.2). On my other PC the same code is successfully builded.
It means that build scripts are correct.
So I assume that it is something with Gradle configuration, but I double rechecked all configs:
I completely removed .gradle folder under C:\Windows\Users{MyUser}.gradle to delete old configurations;
gradle.properties file doesn`t have any uncommented options
What do I miss?
NOTE! I have not specified '--daemon' option. Or I only think so:( I can`t find it in Gradle default and project specific settings
Also I created absolutely new project in the studio. It didn`t help - the same error(
The answer is very simple. It seems that new version of Android studio imported all setting from previous one. Some of old options added additional options to compiler
Android Studio always uses a Gradle daemon. It connects to the daemon via the Gradle Tooling API, and perhaps the latter doesn't understand --daemon (because it's redundant).

How can I view Android build Gradle tasks from Android Studio?

I was dealing with this bug recently while learning my way around AS.
I could see that the error was occurring after running aapt during the :app:processDebugResources gradle task.
The Gradle window is available from View -> Tool Windows -> Gradle, where I can see a list of all of these tasks that are presumably found in the Android Build plugin. Is there any way to view those tasks from AS? Could I access the source code for the plugin somewhere? The context menu presents no useful options, except Open Gradle config which is greyed out.
You can find the source for the android gradle plugin here (check it out in git).
The question you linked to says the bug is caused by a missing resource? Maybe run lint checks to find missing resources?

Categories

Resources