[SOLVED] AndroidHarnessFragment import is not seen

Hello
I’ve begun to study JME3. More concretely, I’ve tried to use AndroidStudio as IDE and tried to write an android application. But when I try to import AndroidHarnessFragment, the import colours grey and red.

build.gradle

plugins {
    id 'com.android.application'
}

android {
    compileSdk 30

    defaultConfig {
        applicationId "org.lunapark.dev.jmonkey3template"
        minSdk 29
        targetSdk 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation "org.jmonkeyengine:jme3-core:3.4.0-stable"
    implementation "org.jmonkeyengine:jme3-desktop:3.4.0-stable"
    implementation "org.jmonkeyengine:jme3-lwjgl:3.4.0-stable"
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.3.0'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

How to make AndroidHarnessFragment import correctly? I’m trying

import com.jme3.app.AndroidHarnessFragment;

Android Studio Arctic Fox | 2020.3.1 Patch 3
Build #AI-203.7717.56.2031.7784292, built on October 1, 2021
Runtime version: 11.0.10+0-b96-7249189 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 4.15.0-162-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: Batch Scripts Support, CMD Support, com.codota.csp.intellij, org.jetbrains.kotlin
Current Desktop: ubuntu:GNOME

Remove those

and

add this :

    implementation "org.jmonkeyengine:jme3-android-native:3.4.0-stable"

Sync gradle, clean project and rebuild.

For jme3 quick start examples on android check these projects :

3 Likes

Thanks a lot! You’ve made my day :sunny:

2 Likes