Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wiish run --os android fails #86

Open
UNIcodeX opened this issue Dec 21, 2020 · 7 comments
Open

wiish run --os android fails #86

UNIcodeX opened this issue Dec 21, 2020 · 7 comments

Comments

@UNIcodeX
Copy link

NOTE: I am able to build Android apps and run them on a physically tethered device and emulators using NativeScript on this machine, so my build deps should all be good to go.

Output of wiish doctor

oo ee oo ah ah
o standard/os os=ios,ios-simulator
iOS can only be built on the macOS operating system
FIX: Give money to Apple to fix this

---------------------------------------------------------------------------------------------------------------
√ standard/ANDROID_SDK_ROOT os=android
√ standard/ANDROID_HOME os=android
√ standard/ANDROID_NDK_HOME os=android
√ standard/ndk-build os=android
√ standard/emulator os=android
√ standard/sdk-platform-tools os=android
√ standard/devices os=android
√ webview/gtk+-3.0 os=linux
√ webview/webkit2gtk-4.0 os=linux
√ sdl2/sdl2 os=linux
√ sdl2/SDL2_ttf os=linux
√ sdl2/SDL2_image os=linux
√ sdl2/SDL2_gfx os=linux
ting tang walla walla bing bang!
ok

Output of wiish run --os android

[wiish] Setup/ build starting...
[wiish] Setup/ projectPath:   .
[wiish] Setup/ targetOS:      android
[wiish] Setup/ targetFormat:  run
[wiish] Setup/ verbosity:     false
[wiish] Setup/ config: (name: "WiishWebview", version: "0.1.0", src: "main.nim", dst: "dist", icon: "", resourceDir: "resources", nimflags: @[], windowFormat: Webview, codesign_identity: "", bundle_identifier: "com.example.wiishdemo", category_type: "", sdk_version: "", ios_simulator: false, ios_provisioning_profile: "", java_package_name: "org.wiish.webviewexample")
[wiish] Setup/Wiish start
[wiish] Setup/Wiish Removing old build dir: dist/android/project/org.wiish.webviewexample
[wiish] Setup/WiishWebview start
[wiish] Setup/WiishWebview Copying Android template project to dist/android/project/org.wiish.webviewexample
[wiish] Compile/Wiish start
[wiish] Compile/Wiish nim c -d:appJavaPackageName=org.wiish.webviewexample --os:android -d:android -d:androidNDK --cpu:arm --noMain:on --gc:orc --header --threads:on --tlsEmulation:off --hints:off --compileOnly -d:appJavaPackageName=org.wiish.webviewexample --nimcache:dist/android/project/org.wiish.webviewexample/app/jni/src/armeabi-v7a ./main.nim
[wiish] Compile/Wiish Writing dist/android/project/org.wiish.webviewexample/app/jni/src/armeabi-v7a/nimbase.h for Nim version 1.4 ...
[wiish] Compile/Wiish nim c -d:appJavaPackageName=org.wiish.webviewexample --os:android -d:android -d:androidNDK --cpu:arm64 --noMain:on --gc:orc --header --threads:on --tlsEmulation:off --hints:off --compileOnly -d:appJavaPackageName=org.wiish.webviewexample --nimcache:dist/android/project/org.wiish.webviewexample/app/jni/src/arm64-v8a ./main.nim
[wiish] Compile/Wiish Writing dist/android/project/org.wiish.webviewexample/app/jni/src/arm64-v8a/nimbase.h for Nim version 1.4 ...
[wiish] Compile/Wiish nim c -d:appJavaPackageName=org.wiish.webviewexample --os:android -d:android -d:androidNDK --cpu:i386 --noMain:on --gc:orc --header --threads:on --tlsEmulation:off --hints:off --compileOnly -d:appJavaPackageName=org.wiish.webviewexample --nimcache:dist/android/project/org.wiish.webviewexample/app/jni/src/x86 ./main.nim
[wiish] Compile/Wiish Writing dist/android/project/org.wiish.webviewexample/app/jni/src/x86/nimbase.h for Nim version 1.4 ...
[wiish] Compile/Wiish nim c -d:appJavaPackageName=org.wiish.webviewexample --os:android -d:android -d:androidNDK --cpu:amd64 --noMain:on --gc:orc --header --threads:on --tlsEmulation:off --hints:off --compileOnly -d:appJavaPackageName=org.wiish.webviewexample --nimcache:dist/android/project/org.wiish.webviewexample/app/jni/src/x86_64 ./main.nim
[wiish] Compile/Wiish Writing dist/android/project/org.wiish.webviewexample/app/jni/src/x86_64/nimbase.h for Nim version 1.4 ...
[wiish] PreBuild/Wiish start
[wiish] PreBuild/Wiish Creating icons ...
[wiish] PreBuild/Wiish Copying in resources ...
[wiish] PreBuild/Wiish Prepare to create Activity ...
[wiish] PreBuild/WiishWebview start
[wiish] PreBuild/WiishWebview Writing dist/android/project/org.wiish.webviewexample/app/src/main/java/org/wiish/webviewexample/webviewexampleActivity.java
[wiish] PreBuild/WiishWebview Listing c files ...
[wiish] Build/Wiish start
[wiish] Build/Wiish Naming app ...
[wiish] Build/Wiish Building with gradle in dist/android/project/org.wiish.webviewexample ...

> Configure project :app
NDK is missing a "toolchains" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to /home/jedi/Android/Sdk.
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.

* 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 0s
/home/jedi/.nimble/pkgs/wiish-0.1.0/wiish/build.nim(124) wiish_build
/home/jedi/.nimble/pkgs/argparse-2.0.0/argparse/backend.nim(613) run
/home/jedi/.nimble/pkgs/argparse-2.0.0/argparse/backend.nim(607) run
/home/jedi/.nimble/pkgs/argparse-2.0.0/argparse/backend.nim(532) parse
/home/jedi/.nimble/pkgs/wiish-0.1.0/wiish/build.nim(93) :anonymous
/home/jedi/.nimble/pkgs/wiish-0.1.0/wiish/plugins/standard.nim(27) runStep
/home/jedi/.nimble/pkgs/wiish-0.1.0/wiish/plugins/standard/build_android.nim(151) androidRunStep
/home/jedi/.nimble/pkgs/wiish-0.1.0/wiish/building/buildutil.nim(159) sh
Error: unhandled exception: Error running process [CatchableError]
Error: execution of an external program failed: '/home/jedi/Documents/repositories/test/somedir/wiish_build run --os android'
buildutil.nim(159)       sh
Error: unhandled exception: Error running process [CatchableError]

@iffy
Copy link
Owner

iffy commented Dec 21, 2020

Thanks for providing the log!

The solution, I think, is to install the Android NDK, as indicated by this in the logs:

...
NDK is missing a "toolchains" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to /home/jedi/Android/Sdk.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
...

I'm trying to decide if wiish doctor should include these instructions or if it's fine to defer to what this log is showing.

@UNIcodeX Do you have the Android NDK installed? What does ls $ANDROID_NDK_HOME show?

@UNIcodeX
Copy link
Author

Yes, sir. It is installed, however there may be an issue with architecture??

output of yay -Qi android-ndk:

Name            : android-ndk
Version         : r22-1
Description     : Android C/C++ developer kit
Architecture    : x86_64
URL             : https://developer.android.com/ndk/
Licenses        : GPL  LGPL  custom
Groups          : None
Provides        : None
Depends On      : glibc
Optional Deps   : ncurses5-compat-libs: for using gdb
                  python2: various helper scripts [installed]
                  python: various helper scripts [installed]
Required By     : None
Optional For    : None
Conflicts With  : None
Replaces        : android-ndk64
Installed Size  : 3.53 GiB
Packager        : Unknown Packager
Build Date      : Thu 17 Dec 2020 09:49:15 AM CST
Install Date    : Thu 17 Dec 2020 09:49:55 AM CST
Install Reason  : Explicitly installed
Install Script  : Yes
Validated By    : None

Would it perhaps require android-ndk64 instead?

@UNIcodeX
Copy link
Author

It should be mentioned that I have both the Arch linux android-ndk and the android-studio packages installed. I had originally set ANDROID_HOME to /opt/android-sdk, but ended up having to switch it to ~/Android/Sdk.

NOTE: The platforms directory is under that ~/Android/Sdk directory as well.

@iffy
Copy link
Owner

iffy commented Dec 22, 2020

I'm not smart enough with Android development to know if it's an architecture problem. Wiish is currently set up to build the an apk for 4 architectures, but I don't remember if it requires the NDK/SDK to be for a specific architecture.

Here's what I have on my macOS machine:

$ echo $ANDROID_HOME
/Users/matt/Library/Android/sdk
$ echo $ANDROID_NDK_HOME
/Users/matt/Library/Android/sdk/ndk-bundle
$ ls -al $ANDROID_HOME
total 8
drwxr-xr-x  16 matt  staff  512 Oct 23 16:51 .
drwxr-xr-x   3 matt  staff   96 Aug 10  2019 ..
-rw-r--r--   1 matt  staff   16 Dec 16 12:18 .knownPackages
drwxr-xr-x   2 matt  staff   64 Aug 12  2019 .temp
drwxr-xr-x  18 matt  staff  576 Oct 23 16:51 android-toolchain
drwxr-xr-x   5 matt  staff  160 Aug 12  2019 build-tools
drwxr-xr-x  17 matt  staff  544 Aug 10  2019 emulator
drwxr-xr-x   3 matt  staff   96 Aug 10  2019 extras
drwxr-xr-x   3 matt  staff   96 Aug 10  2019 licenses
drwxr-xr-x  23 matt  staff  736 Aug 12  2019 ndk-bundle
drwxr-xr-x   3 matt  staff   96 Aug 10  2019 patcher
drwxr-xr-x  22 matt  staff  704 Aug 10  2019 platform-tools
drwxr-xr-x   5 matt  staff  160 Aug 12  2019 platforms
drwxr-xr-x  26 matt  staff  832 Aug 10  2019 skins
drwxr-xr-x   3 matt  staff   96 Aug 10  2019 system-images
drwxr-xr-x  14 matt  staff  448 Aug 10  2019 tools
$ ls -al $ANDROID_NDK_HOME
total 2824
drwxr-xr-x  23 matt  staff     736 Aug 12  2019 .
drwxr-xr-x  16 matt  staff     512 Oct 23 16:51 ..
-rw-r--r--   1 matt  staff    2172 Aug 12  2019 CHANGELOG.md
-rw-r--r--   1 matt  staff  611758 Aug 12  2019 NOTICE
-rw-r--r--   1 matt  staff  779281 Aug 12  2019 NOTICE.toolchain
-rw-r--r--   1 matt  staff     730 Aug 12  2019 README.md
drwxr-xr-x  21 matt  staff     672 Aug 12  2019 build
drwxr-xr-x   5 matt  staff     160 Aug 12  2019 meta
-rwxr-xr-x   1 matt  staff      72 Aug 12  2019 ndk-build
-rwxr-xr-x   1 matt  staff      91 Aug 12  2019 ndk-gdb
-rwxr-xr-x   1 matt  staff      93 Aug 12  2019 ndk-stack
-rwxr-xr-x   1 matt  staff      93 Aug 12  2019 ndk-which
-rw-r--r--   1 matt  staff   17822 Aug 12  2019 package.xml
drwxr-xr-x  14 matt  staff     448 Aug 12  2019 platforms
drwxr-xr-x   7 matt  staff     224 Aug 12  2019 prebuilt
drwxr-xr-x   8 matt  staff     256 Aug 12  2019 python-packages
drwxr-xr-x   3 matt  staff      96 Aug 12  2019 shader-tools
drwxr-xr-x  22 matt  staff     704 Aug 12  2019 simpleperf
-rw-r--r--   1 matt  staff      51 Aug 12  2019 source.properties
drwxr-xr-x   5 matt  staff     160 Aug 12  2019 sources
drwxr-xr-x   4 matt  staff     128 Aug 12  2019 sysroot
drwxr-xr-x   8 matt  staff     256 Aug 12  2019 toolchains
drwxr-xr-x   6 matt  staff     192 Aug 12  2019 wrap.sh

Do you have an ndk-bundle directory in $ANDROID_HOME? The error is specifically looking for a toolchains directory. Does find $ANDROID_HOME -name toolchains find anything promising? If so, maybe try setting ANDROID_NDK_HOME to the directory containing toolchains.

Once we've figured out what's wrong, I'd love to add something to wiish doctor that might aid the next person who encounters this error.

@UNIcodeX
Copy link
Author

I don't currently have the ANDROID_NDK_HOME explicitly exported in my .zshrc, but it's pointing to the same location as ANDROID_HOME. ANDROID_SDK_ROOT also points to the same place.

ANDROID_HOME = ANDROID_SDK_ROOT = ~/Android/Sdk

The contents of that directory are:

total 12K
834663576    0 drwxr-xr-x 14 jedi jedi  238 Dec 17 10:35 ./
545319185    0 drwxr-xr-x  3 jedi jedi   17 Dec 17 10:19 ../
569167838    0 drwxr-xr-x  4 jedi jedi   34 Dec 21 10:43 build-tools/
 45497847    0 drwxr-xr-x  2 jedi jedi    6 Dec 17 10:39 .downloadIntermediates/
 42214031 4.0K drwxr-xr-x  7 jedi jedi 4.0K Dec 17 10:19 emulator/
836966888 4.0K -rw-r--r--  1 jedi jedi   16 Dec 21 10:43 .knownPackages
578060001    0 drwxr-xr-x  2 jedi jedi   33 Dec 17 10:35 licenses/
 42214032    0 drwxr-xr-x  3 jedi jedi   16 Dec 17 10:19 patcher/
549821487    0 drwxr-xr-x  4 jedi jedi   42 Dec 21 10:43 platforms/
826876071    0 drwxr-xr-x  5 jedi jedi  314 Dec 17 10:20 platform-tools/
575755870 4.0K drwxr-xr-x 32 jedi jedi 4.0K Dec 17 10:30 skins/
 44845446    0 drwxr-xr-x  3 jedi jedi   24 Dec 17 10:20 sources/
835885419    0 drwxr-xr-x  4 jedi jedi   42 Dec 17 10:36 system-images/
834663602    0 drwxr-xr-x  2 jedi jedi    6 Dec 17 10:39 .temp/
 42214560    0 drwxr-xr-x  6 jedi jedi  205 Dec 17 10:20 tools/

@UNIcodeX
Copy link
Author

The distro's android-ndk package installs to /opt/android-ndk and contains a toolchains folder, but when I set ANDROID_NDK_HOME to that directory and try to build, gradle complains that the directory does not contain a platforms directory...

The platforms were installed to ~/Android/Sdk by the Android Studio wizard.

@iffy
Copy link
Owner

iffy commented Jan 21, 2021

@UNIcodeX If you symlink the ndk into the sdk directory so that they're kind of together like on my computer (and set the appropriate ANDROID_ environment variables) does it work?

Sorry to leave you hanging for a month.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants