Archive 17/01/2023.

Android :android:urho3d-lib:generateJsonModelDebug failed task

Joshua-PotatoMan

hi i am new to urho3d engine i’ve been using it for that past a couple of days and everything was going smoothly… however yesterday i tried to compile the urho3d librays for android using gradle and it failed with this error
--------------------------------------------------------------------------------------->

Task :android:urho3d-lib:generateJsonModelDebug FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ‘:android:urho3d-lib:generateJsonModelDebug’.
java.lang.NullPointerException (no error message)

-------------------------------------------------------------------------------------->

i did look at the legacy docs and found that i had to install data & autoload in an asset folder inside launcher-app and Coredata in assets inside urho3d-lib
however that didn’t fix the problem and i still get the same problem

i used android studio and it failed to sync to the libray.

if this has happen before or its just a new problem i’d be happy if you tell me how to fix it :wink:

weitjong

If you use main branch to build then follow the new online doc where it specifically states the version of the currently supported Android plugin and NDK.

You are on your own when you use other newer version available. I suspect if you newly installed Android Studio then you might have newer Android plugin that Urho does support. That’s the only reason I can think of that causing the initial gradle sync to fail. Having said that, I f you are able to use the latest plugin and get it to work, please share your fixes.

tungts1101

I also got this error with the main branch. I check the gradle plugin version in File\Project Structure in Android Studio and it is 4.0.2. Do you have any hint in this problem?

1vanK

I’m still investigating this issue. Some cmake versions conflicts. After this https://github.com/urho3d/Urho3D/pull/2949 minimal CMake version is 3.15, but old Android sdk can use old cmake plugin only

1vanK

I have no experience with mobile development. Can You test/hilp with this Android: allow use CMake > 3.10.2.4988404, update gradlew to 7.5.1, u… by 1vanK · Pull Request #3049 · urho3d/Urho3D · GitHub

feresmu

Hi.
With the last sources it compiles without errors with Android Studio Chipmunk | 2021.2.1 Patch 2

The apk runs but shows nothing.

That is because launcher-app-debug.apk have only libUrho3DPlayer.so in lib\armeabi-v7a\ folder

It seems that CMakeLists.txt are ok. Any idea to fix it?

SirNate0

Were the samples enabled for the build?

1vanK
feresmu

If I uncomment that the apk have all the .so samples but still shows nothing

elix22

Logcat is your best friend in debugging such issues .

Make sure that the assets folder in your APK is not empty.
You can unzip the APK by changing its extension to “.zip” and verify that the assets are there.

Android/app/src/main/assets/Data
Android/app/src/main/assets/CoreData

feresmu

I have the assets and .so samples in the apk

I think the problem is that LauncherActivity cannot find (and because that, doesn’t show) the library files.

If I modify LauncherActivity.kt in this way:

class LauncherActivity : ExpandableListActivity() {

    // Filter to only include filename that has an extension
    private fun getScriptNames(path: String) = assets.list(path)!!.filter { it.contains('.') }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

			// Start CharacterDemo sample 
            startActivity(
                Intent(this, MainActivity::class.java)
                    .putExtra(
                        MainActivity.argument,
						"18_CharacterDemo"
                    )
            )		
return;

it works if I launch 18_CharacterDemo only. So the problem seems to be UrhoActivity.getLibraryNames() function

1vanK

It would be nice if you create a pull request with a fix

feresmu

I’ don’t know how to fix the problem (not yet at least :wink: (I have clarified my post)

But it seems to be UrhoActivity.getLibraryNames() function (I am not android/urho3d expert, not know what would be the problem)

SirNate0

I’m not sure, but I suspect the filtering looking for the . in the name may be wrong since you are adding a name without the . and it works.