Android :android:urho3d-lib:generateJsonModelDebug failed task

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:

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.

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?

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

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

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?

Were the samples enabled for the build?

2 Likes

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

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

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

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

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)

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.