Build gradle project for android

how to build gradle broject for adndoid?

The jmonkey initializer at https://start.jmonkeyengine.org/ can create a starter project for android using gradle

2 Likes

I create project
i run ā€œclean an buildā€ and display this error

SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your projectā€™s local properties file at ā€˜/home/ivan/WW2Paris/local.propertiesā€™.

but in project folder Šµhere is not local.properties file

You can create one and add

sdk.dir=path to android ndk
1 Like

Errors when i build project

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules jetified-guava-19.0 (com.google.guava:guava:19.0) and jetified-listenablefuture-1.0 (com.google.guava:listenablefuture:1.0)
     
     Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
   > 2 files found with path 'com/simsilica/lemur/style/base/glass-styles.groovy' from inputs:
      - /home/ivan/.gradle/caches/transforms-3/5e642b745d3b64e896a192c4607fa302/transformed/jetified-lemur-proto-1.13.0.jar
      - /home/ivan/.gradle/caches/transforms-3/64e7a6318b4d6a8692fcfcd55dfd1eb0/transformed/jetified-lemur-1.16.0.jar
     Adding a packagingOptions block may help, please refer to
     https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.PackagingOptions.html
     for more information

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

i add
implementation ā€˜com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guavaā€™
and solve it

but not i have new error

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ā€˜:app:mergeDebugJavaResourceā€™.

A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
2 files found with path ā€˜com/simsilica/lemur/style/base/glass-styles.groovyā€™ from inputs:
- /home/ivan/.gradle/caches/transforms-3/5e642b745d3b64e896a192c4607fa302/transformed/jetified-lemur-proto-1.13.0.jar
- /home/ivan/.gradle/caches/transforms-3/64e7a6318b4d6a8692fcfcd55dfd1eb0/transformed/jetified-lemur-1.16.0.jar
Adding a packagingOptions block may help, please refer to
https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.PackagingOptions.html
for more information

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use ā€˜ā€“warning-mode allā€™ to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See Command-Line Interface

BUILD FAILED in 5s
24 actionable tasks: 23 executed, 1 up-to-date

I have not tried Lemur on Android yet but this issue has been reported multiple times in the past on the forum, I am sure you will find more if you search the forum.

I guess the most recent one was

1 Like

donā€™t understand what I should do?

i delete lemur and log4j
project build successfully

now where is ac file and how to run android emmulator?

I followed these tutorials for setting up an android emulator using Android SDK Command-line tools

https://www.youtube.com/playlist?list=PLTyVJ9m1QDNcgm8l2xovDSm9YrT6y5wzx

1 Like

run emulator but how to run apk under emulator?

./adb devices

List of devices attached
emulator-5554 device
emulator-5558 device

adb -d install app-release-unsigned.apk

adb: no devices found

solve it
adb devices should show physical devices and emulators. adb -d means only physical device which adb says does not exist

and have new error
adb: failed to install app-release-unsigned.apk: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vmdl2127242235.tmp/base.apk: Attempt to get length of null array]

solve it

and have new error
INSTALL_FAILED_OLDER_SDK

solved

defaultConfig {
applicationId ā€œwwparis.WWParisā€
minSdk 22
targetSdk 32
versionCode 1
versionName ā€œ1.0ā€

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

now for run 3d application i need create class and call method start or no?

public class AndroidLauncher extends AndroidHarness {

    public AndroidLauncher() {
        appClass = WWParis.class.getCanonicalName();
        
    }
}

I am using this old android example template

but there are also newer examples using android surface view which you can find by searching the forum.

1 Like
1 Like

Cool, thank you :slightly_smiling_face:

1 Like