I'm trying to compile and run Google's MLKit sample https://github.com/googlesamples/mlkit. Code uses kotlin and there is one compiling issue, where I had to add '.toString()', when 'String' was expected, but got 'String?'. After that manual code correction gradle process tries to compile the project, but task ':app:mergeDexDebug' newer ends. Tried hours. I use Ubuntu 20.04, downloaded official Android-Srudio, unzipped to my home directory's subdirectory and let it to upgrade itself as it wanted.
Android-Studio wan't to upgrade MLKit project to use newer gradle and gradle-wrapper and tried both let upgrade to be done and not to upgrade, but there was no difference. Grdle-process continues until it goes to task ':app:mergeDexDebug', which newer ends.
I have downloaded latest java and set my set it in other projects's settings to be used and kit works fine with those project. Anothed option is use Android Studios internal java and it seems, that MLKit sample project uses that, because, when you open new project in Android-Studio, it start co compile MLKit sample projectit automatically and you don't have time to configure it by hand before to compile. Or yes, I have some time to comfigure foreground, because gradle works in background, until gradle is in the task ':app:mergeDexDebug', but it is hard to test result of that kind configuration, because you can't exit from Andpoid-Studio normally, but it warns you that gradle processes are still running and when you exit, java-processes will still keep running and if your kill them, but gradle cache will not be in normal state and there will be lockfiles etc and you can't use grade until you have removed gradle cache. So it is hard to study what goes wrong. Any idea?
Seems that problem was with gradle settings, too low memory setting. Because I could not compile original MLKit example projects, I started to build another project based on MLKit example projects code. With that process I had error in compilation also and adjusted gradle memory setting from original 256MB to 1024MB and continued. After some hours and some Android Studio restarts I checked original MLKit example project, and noticed that it had been compiled in background. I could install it in to my phone. By the way, this example project introduces bar code scanning and object detecting. Object detecting does not do anything reasonable, because it can maybe show objects in camera view or picture, but can not name them, but barcode scanning works fine.
Related
After a hiatus of a couple of years I'm picking up Android development again.
I installed the newest Android Studio(4.1.1) with the latest Android SDK version (Android 11, API 30). After that I created a new project with gdx-setup.
If I add the old java source to my newly generated project I get this error:
error: package com.badlogic.gdx.backends.android does not exist
I'm not sure how to add this jar into the new project. In the Gradle configuration I see mentions of the backend, but it's not available.
I also downloaded the 'gdx-backend-android.jar' from the nightly build and put the jar in the Android library folder, all to no avail.
Does anyone actually know how to correctly add this dependency into my project?
I added the jar but still have an error, don't mind the other errors, I first need to fix the GDX import.
The project dependencies are managed by Gradle, so there is no need for you to directly touch any .jar files at all.
The most likely issue you're facing is that you are trying to use Android-specific classes from the core module, which is platform agnostic.
In a typical libGDX project, you do almost all your game code in the core module so it can easily be compiled for any platform. The code you showed above would be in the android module, but your LiveWallpaperStarter class would be part of core.
Some might say there's no reason to use core at all if you're making a Live Wallpaper, since it can't run on any other platforms besides Android. But there is some advantage in keeping the rendering in core so you can test in a desktop game window, because you can more rapidly compile and run on the desktop. This library has some tools that make it easy to wrap your rendering code in a class that lets you simulate a live wallpaper on desktop, for testing.
So basically I haven't opened my Android Studio project for almost a year and this time was the time for it to be opened and built. After updating Android Studio and all of the project's plugins, I finally reach this error:
Execution failed for task ':app:processDebugResources'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform play-services-base-17.1.0.aar (com.google.android.gms:play-services-base:17.1.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.status=release}.
> Execution failed for AarResourcesCompilerTransform: C:\Users\Me\.gradle\caches\transforms-2\files-2.1\d92a27efcac738b4f280b9ad0c07bda7\jetified-play-services-base-17.1.0.
> AAPT2 aapt2-4.1.1-6503028-windows Daemon #0: Unexpected error during compile 'C:\Users\Me\.gradle\caches\transforms-2\files-2.1\d92a27efcac738b4f280b9ad0c07bda7\jetified-play-services-base-17.1.0\res\drawable-xhdpi-v4\common_google_signin_btn_text_dark_normal_background.9.png', attempting to stop daemon.
This should not happen under normal circumstances, please file an issue if it does.
I hope someone could help me resolve this issue. Thanks in advance.
update 07 May 2021
With Android Studio 4.2 and the corresponding android gradle plugin v4.2.0 (which requires gradle 6.7.1) the build now works for me also on my older AMD.
So I guess the problem has been fixed :)
(would be great if someone else can confirm via comment)
original answer
Hi have exactly the same issue.
The project builds on 2 of 3 tested PCs. The only difference I see is, that is not working on an older AMD processor. The PCs its working with have both Intel CPUs (an older i7, 2. Gen, and a new i7). All three PCs are running with Windows 10 Pro.
My dev environment is set up equally on all 3 PCs.
I hope this information helps to find a maybe better solution.
The only solution I found is to go back to a previous version of the Gradle plugin and Gradle itself.
In gradle-wrapper properties I defined Gradle version 6.1.1
distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip
And in the project build.gradle I set version 4.0.2
classpath 'com.android.tools.build:gradle:4.0.2'
Try:
Invalidate Cache / Restart
Clean Project
Rebuild Project
Along same lines: I too am getting this same error but oddly, my project is stored on OneDrive so I can access it/modify it from different locations. The SAME project builds, installs and runs with no issue at one location (with my phone connected to computer), but the error shown above takes place when accessing the same files from the other location (with the same phone connected).
The same version of Android Studio is being used at both locations as well. This was not an issue with this same project a few days ago (i.e. - it ran properly from both locations until recently)
The solution offered previously here does not fix the issue.
Would not normally put this response here but thought perhaps my experience with the same error message could help shed some light on what is happening.
the same topic is discussed here. I have the same behavior the same project builds without a problem on i7. But produces an error on an old AMD processor.
I'm using the new gradle build switch when sending an Android build for Codename One. One of the highlighted benefits of building with gradle is the ability to open/run in Android Studio and indeed the project opens for me but I'm getting the following error:
Error:Unable to load class
'org.codehaus.groovy.runtime.StringGroovyMethods'. Possible causes for
this unexpected error include:Gradle's dependency cache may be
corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires
network)The state of a Gradle build process (daemon) may
be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires
restart)Your project may be using a third-party plugin
which is not compatible with the other plugins in the project or the
version of Gradle requested by the project.In the case of
corrupt Gradle processes, you can also try closing the IDE and then
killing all Java processes.
I restarted the process, the IDE and did quite a few things with no real success.
I had the exact same issue and corresponded with Codename One support a while back and it turns out the solution is rather simple:
Define your own installation of gradle as the one to use, this is what Chen from CodenameOne sent to me as a reference:
I installed gradle 2.8 and configured it as such in the settings and that almost worked. I also had to follow the instructions of Android Studio - supplied javaHome is not a valid folder & even After update of AS to 1.0, getting "method ID not in [0, 0xffff]: 65536" error in project despite the fact that multi-sex was not necessary in the server?
Is there any documentation on converting a application.mk/android.mk file to a gradle based build.gradle file?
good links, QArea. Thanks a lot!
At this moment NDK support in Gradle are very limited. If you need to assemble something that gradle not provides that function
I do like this.
I collect the old-fashioned, but to .so-patches automatically picks up the Gradle-plugin:
ndk-build -j4 NDK_LIBS_OUT=src/main/jniLibs
Otherwise, you must wait for next version of gradle 0.13. Devs promise that NDK will fix integration with NDK.
I made a script tool to convert android.mk building system to gradle building system, because I wanted to test the demo source codes in:
https://android.googlesource.com/platform/development/+/05523fb0b48280a5364908b00768ec71edb847a2/samples
But after searching whole internet, I found no one did it yet. So I created this tool by myself. But even with this tool, we couldn't ensure all projects in AndroidSamples could be built and executed successfully because of the API versions and features mismatch. So I created my own projects for https://android.googlesource.com/platform/development/+/05523fb0b48280a5364908b00768ec71edb847a2/samples
And I want to convert those demo projects one by one.
Now the whole source codes are here:
https://github.com/clockzhong/AndroidSamples
I already successfully converted some samples into gradle building system and executed them correctly on my android phones. But I still have some version mismatch issues, anyway, I'll mentioned it in the project check-in comments.
we made one application on Visual Studio 2008 , it about to release. but now we are getting the crash while launching the application . could you please any give a suggestion how do i debug on this particular issue
You can run the Release build in the debugger, too. Turn on debug-info settings in both the compiler and linker tabs (I think that was not the default in vs2008 and there were two distinct places to set) but don't change any optimization options or other setting.
Then launch the program from the debugger. If the resulting EXE shows the crash when run normally but not when started via the debugger, there are more things to make the situations work the same (and that shows clues as to what is wrong, too). So let us know if that still doesn't reproduce.
There could be a lot of reasons for your application's Release is crashing.
Did you link proper Release libraries with your application in Visual Studio project configuration ?
Check your code for some missing Release specific code.
My best guess is you are not linking to proper libraries for the Release version of your application.
Also, one reason could be that your application may be trying to load some file that may not exist. This happens with me sometimes when my Release build of application does not find file that it needs (Eg: OpenGL application trying to load a shader file that is missing); and you don't check for errors.