Android debug with android studio 4

68 views
Skip to first unread message

Dennis Rogers

unread,
Apr 28, 2021, 6:43:31 PM4/28/21
to CodenameOne Discussions
Can I debug on an android device with android studio 4+? If not which version should I use?

Shai Almog

unread,
Apr 28, 2021, 9:56:23 PM4/28/21
to CodenameOne Discussions
Yes. What matters is the gradle version. I suggest using Gradle 6.5 and defining android.appBundle=true in the build hints.

Also you can migrate to maven (if you aren't there already) and do a local build. This will launch Android Studio seamlessly upon build so you can debug. See this: https://shannah.github.io/cn1-maven-archetypes/cn1app-archetype-tutorial/getting-started.html#android

Dennis Rogers

unread,
May 10, 2021, 1:06:49 PM5/10/21
to CodenameOne Discussions
I've migrated to maven and am able to run the project on the simulator. When I try to run it on a device, however, I can't access the "Codename one" menu. How do I build to a device ?

P5music

unread,
May 10, 2021, 4:29:15 PM5/10/21
to CodenameOne Discussions
I think that when the local build ends in your IDE , Andoid Studio opens automatically, where you will have the Android project automatically created for you to compile in Android Studio. Connect the device and simply run the application.
You also can start the AVD emulator and do the same instead of connecting a real device.
Regards

Shai Almog

unread,
May 10, 2021, 11:10:21 PM5/10/21
to CodenameOne Discussions
The Codename One menu isn't applicable for the Maven projects. You no longer need the plugin when working with Maven. Just select the target from your IDE.

Dennis Rogers

unread,
May 15, 2021, 11:37:29 AM5/15/21
to CodenameOne Discussions
I built the project for the device and it said I needed to run the project, ~/IdeaProject/MyProject/android/target/....
When I do that, using android-studio, I get the error:

Error: Cause org.jetbrains.plugins.gradle.tooling.util.ModuleComponetnIdentifierimpl.getModuleIdentifier()Lorg/gradle/api/artifacts/ModuleIdentifier

Is there another plugin I need for android-studio? 

-Dennis

Dennis Rogers

unread,
May 15, 2021, 4:58:41 PM5/15/21
to CodenameOne Discussions
Never mind the last post. I think I've resolved it :-|

Dennis Rogers

unread,
May 17, 2021, 1:09:50 PM5/17/21
to CodenameOne Discussions
I'm still trying to do an android build but have a new problem. After trying to rebuild the code on Android Studio 4.2 beta, I get the message:

Failed to find Platform SDK with path: platforms;android-0

I looked into my build.gradle file and see compileSdkVersion and targetSdkVersion set to zero. Is that normal? -Dennis

Shai Almog

unread,
May 17, 2021, 10:12:27 PM5/17/21
to CodenameOne Discussions
I doubt we support the beta version of Android Studio at the moment. I don't think that's normal though.

Dennis Rogers

unread,
May 19, 2021, 5:18:32 PM5/19/21
to CodenameOne Discussions
What version of Android Studio would you recommend ?

Shai Almog

unread,
May 19, 2021, 10:33:10 PM5/19/21
to CodenameOne Discussions
I still use 3.x locally but I'm pretty sure 4.0 will work well. I've heard bad things on 4.2 so far, people say it's even slower.
Reply all
Reply to author
Forward
0 new messages