VDavid003 / sm64-port-android-base

A port of https://github.com/sm64-port/sm64-port for Android.
181 stars 49 forks source link

Fails to compile (java.lang.NullPointerException (no error message) #50

Open nmchlngy4 opened 3 years ago

nmchlngy4 commented 3 years ago

I used to be able to compile this, but recent changes in the Android SDK and NDK are now preventing me from compiling this frustrating port.

When I tried to compile it, I got the following output: `> Configure project :app NDK is missing a "platforms" directory. If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to /home/eunha/android-sdk/ndk-bundle. If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

FAILURE: Build failed with an exception.

BUILD FAILED in 0s`

I initially thought my Arch Linux install was broken, so I formatted it.

For reference, I am using Android NDK version 21, as well as the Android SDK version installed by the smlinux script by enigma9o7. My OS is Pop!_OS 20.04 (a fork of Ubuntu 20.04).

amp-92 commented 3 years ago

This is the same issue that I posted about in January ( #46 )

Unfortunately I haven't been able to get this to work either on Manjaro, Ubuntu, Windows or even using the docker file in a Linux environment.

If it is an issue with recent changes to Android SDK, it might be possible to compile with an old version of Android command line tools. It looks like the latest version that came out before the last commit was version 30.0.4 (July 2020). I'm not at my Linux machine at the minute, but if you wanted to download that version and test it out, here's the link: https://dl.google.com/android/repository/platform-tools_r30.0.4-linux.zip

Really hoping this works - with the latest version of Android enforcing scoped storage I think this is possibly the only way to get Render96 working on mobile.

nmchlngy4 commented 3 years ago

No dice. Still getting the same error messsage.

Google is more interested in their social justice propaganda than making a proper working SDK.

nmchlngy4 commented 3 years ago

This is the same issue that I posted about in January ( #46 )

Unfortunately I haven't been able to get this to work either on Manjaro, Ubuntu, Windows or even using the docker file in a Linux environment.

If it is an issue with recent changes to Android SDK, it might be possible to compile with an old version of Android command line tools. It looks like the latest version that came out before the last commit was version 30.0.4 (July 2020). I'm not at my Linux machine at the minute, but if you wanted to download that version and test it out, here's the link: https://dl.google.com/android/repository/platform-tools_r30.0.4-linux.zip

Really hoping this works - with the latest version of Android enforcing scoped storage I think this is possibly the only way to get Render96 working on mobile.

And, speaking of scoped storage, I just found out another application I use told me about it too.

Honest-n commented 3 years ago

Managed to build, but I'm not sure which step fixed it... first set the ANDROID_HOME variable $cd ~/Android/Sdk $export ANDROID_HOME="$(pwd)" Then symlinked the platforms folder into the ndk folders $cd ndk $ln -s ../platforms $cd ../ndk-bundle $ln -s ../platforms

and also purged gradle from ubuntu incase there were some version issues. but i'm unsure if this realy helped $sudo apt purge gradle

although after signing the apk and installing it I didn't notice any improved models or textures but the ex menu was working

amp-92 commented 3 years ago

I have no idea why that works, but I tried it and it does. Seems to be the symlinks in the ndk folders that have done the trick. Works when using a specific ndk version instead of ndk-bundle as well.

How did you manage to sign the apk? I'm trying to install it at the minute, but every time I get an "app not installed" error.

Honest-n commented 3 years ago

To sign the apk I used apksigner on termux with the certificate and key from sm64-port-android $ apksigner sign --cert certificate.pem --key key.pk8 ~/storage/shared/app-debug.apk

Sent from my Galaxy

MikeSeaver555 commented 3 years ago

Sorry for writing here, guys. I really love this game, is probable my favorite, and I wish to be able to play it on an Android tv (nvidia shield).

Is the versión for Android complete and compatible with a gamepad?, I got to last step on Ubuntu using docker instrucciones, but I get the error that appears in this issue when I try to convert Linux versión to Android one, it's supossed there is a way to fix it according to the last comments, but i have no idea what I should do. I don't have any folder like ~\Android\Sdk, and I dont know how to install Ndk, y tried through Android studio looking for sdkmanager with no success. Everybody can contact me on telegram @rand4L I would really appreciate any kind of help. Thanks in advance and sorry for writing here.

Honest-n commented 3 years ago

The easiest way I have found to compile for android is to compile in termux then sideload it over adb or use a file manager.

MikeSeaver555 commented 3 years ago

The easiest way I have found to compile for android is to compile in termux then sideload it over adb or use a file manager.

But that means I will install some packages through Termux, I'm afraid of keep packages I won't use anymore or uninstall after using them wrongly, or keep the configuration files by mistakes :/

Does it work with gamepad and no controls on display?

nmchlngy4 commented 3 years ago

It does work.

All you need to do is go to Makefile and set TOUCH_CONTROLS to 0.

The Makefile should look like this: TOUCH_CONTROLS = 0

MikeSeaver555 commented 3 years ago

I see, I'll keep testing, I did that but all I get so far it's the game with standard graphics even I cloned the ex/nightly branch, and I have problems to configure the gamepad, some keys from the keyboard seems to work, but pretty aleatory, I will keep doing some tests, thank you.

Honest-n commented 3 years ago

I can only compile android with the standard graphics. I gave up after 3 days of trying

MikeSeaver555 commented 3 years ago

Oh, it's a pity :( thank you so much for you help, mate.

Honest-n commented 3 years ago

Keep working at it while you still have some drive, if you have any success please post back here. Stick with termux for a portable terminal, if it ever gets too bloated just clear all the data from the package manager and start from fresh. It's great for tinkering with and learning with cli tools, you can even run a full linux distro and use vnc to run a desktop on your android device.

VDavid003 commented 3 years ago

The new commits in master (e5b017dd3421cb2646f853e579c23e4f847389e7 specifically) should fix this without weird workarounds. Please try it!

MikeSeaver555 commented 3 years ago

The new commits in master (e5b017d specifically) should fix this without weird workarounds. Please try it!

If it helps, I can say I was able to compile it before you made this change with the following commands after make (I'm using docker by the way):

echo "sdk.dir = ../usr/lib/android-sdk" > local.properties
docker run --rm -v $(pwd):/sm64 sm64_android sh -c "cp -r /usr/lib/android-sdk/platforms /usr/lib/android-sdk/ndk-bundle && ./gradlew assembleDebug"
sudo apksigner sign --cert ./app/jni/src/certificate.pem --key ./app/jni/src/key.pk8 ./app/build/outputs/apk/debug/app-debug.apk

Now I try just to give you a feedback and I get this error.

$ docker run --rm -v $(pwd):/sm64 sm64_android sh -c "./gradlew assembleDebug"

[blah, blah, blah]

Welcome to Gradle 4.10.2!

[blah, blah, blah]

Starting a Gradle Daemon (subsequent builds will be faster)

> Configure project :app
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to /usr/lib/android-sdk/ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

Observed package id 'build-tools;debian' in inconsistent location '/usr/lib/android-sdk/build-tools/27.0.1' (Expected '/usr/lib/android-sdk/build-tools/debian')
Observed package id 'build-tools;debian' in inconsistent location '/usr/lib/android-sdk/build-tools/27.0.1' (Expected '/usr/lib/android-sdk/build-tools/debian')
File /root/.android/repositories.cfg could not be loaded.
Checking the license for package Android SDK Build-Tools 28.0.2 in /usr/lib/android-sdk/licenses
License for package Android SDK Build-Tools 28.0.2 accepted.
Preparing "Install Android SDK Build-Tools 28.0.2 (revision: 28.0.2)".
"Install Android SDK Build-Tools 28.0.2 (revision: 28.0.2)" ready.
Installing Android SDK Build-Tools 28.0.2 in /usr/lib/android-sdk/build-tools/28.0.2
"Install Android SDK Build-Tools 28.0.2 (revision: 28.0.2)" complete.
"Install Android SDK Build-Tools 28.0.2 (revision: 28.0.2)" finished.
Checking the license for package Android SDK Platform 26 in /usr/lib/android-sdk/licenses
License for package Android SDK Platform 26 accepted.
Preparing "Install Android SDK Platform 26 (revision: 2)".
"Install Android SDK Platform 26 (revision: 2)" ready.
Installing Android SDK Platform 26 in /usr/lib/android-sdk/platforms/android-26
"Install Android SDK Platform 26 (revision: 2)" complete.
"Install Android SDK Platform 26 (revision: 2)" finished.
Observed package id 'build-tools;debian' in inconsistent location '/usr/lib/android-sdk/build-tools/27.0.1' (Expected '/usr/lib/android-sdk/build-tools/debian')

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> java.lang.NullPointerException (no error message)

* 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

BUILD FAILED in 2m 33s