Chrome packaged app and Android NDK - android-ndk

Is it possible to have a Chrome packaged app for Android also include a module built with the Android NDK, and then communicate between the app's javascript and the native NDK module?
Because PNaCl is not yet available for Android, I'm looking for another way to bring C code to that platform also, in place of the PNaCl module that I have for the other platforms.

You can install cordova plugins using the cca tool, and cordova plugins can bundle ndk components. However, there is no utility/project that I know of to help you get started build ing the android ndk -> cordova android -> cordova js.
I don't think it should be hard, especially if you've done cordova/phonegap plugin development before.

Related

Android Studio doesn't start building Flutter project

I've installed Flutter, Dart their SDKs and Android Studio plugins everything needed for Flutter app development, as mentioned here:
https://flutter.dev/docs/get-started/install/windows
But when I go to generate a .apk by selecting Build->Flutter->BuildAPK, Android Studio simply does nothing. It doesn't even start building.
However, if I run command:
flutter build apk
It starts building project.
Any idea?
Well I found the answer.
File -> Settings -> Language & Frameworks -> Flutter
Flutter SDK Path was not set here. When I set appropriate path, it started building.

Android Studio C++ Support Missing

I just installed Android Studio 3.6.3 on Windows 10 and I created a new Native C++ project. I can build and run the native project and I can debug Java code in the project.
The problems I'm having are:
I can't step into the C++ code when debugging
I can't set breakpoints in *.cpp files.
When I right click folders in the project view to add a new file, I only see options to add Java, Kotlin, and Android platform files. There aren't any options to add C++ source or header files.
When I open a C++ file Android Studio recommends installing plugins supporting *.cpp. The plugin it's recommending is for Arma 3 plugin development.
The "Attach Debugger To Process" menu only has Java as a debugger option. That list should also contain Native, Dual, and Auto.
I've made sure to install CMake and NDK (Side By Side) in the SDK Manager and I've configured the NDK in the project settings. I've tried reinstalling Android Studio 3.6.3 and I've also downloaded Android Studio 4.0 RC 1, but I have the same problems.
What steps am I missing to get C++ support in Android Studio?
Managed to get it working. Turns out just running the uninstaller wasn't enough, I had to follow the steps in this answer to completely uninstall Android Studio. I then reinstalled and everything seems to be good.

Could not compile service support class

I have been having this error since for Android compilation .
My sdk url is oky, emulators are being detected but i cant generate any apk or run any android based app. Could
Your question is quite incomplete. Which LC version are you using, which Java JDK are you using, do you use Android Studio (just for the sdk) or do you have it installed via cdm? You need the Android sdk and Java Jdk.

Android NDK - building native libraries without Android Studio

I'm working on a c/c++ cross-platform project, constructed of 2 main libraries (with a few external dependencies: ssl, yajl, fribidi).
The android solution will include Java files and a JNI layer, all bundled in a AAR file (including assets and the native libs).
I managed to build the whole project, but in a very awkward way:
I created a 'hello world' Android app', with native support, from within Android Studio, and added all native dependencies to the CMAkeList.txt. I added my Java code + JNI and managed to create the AAR (only for ARM, for now).
Now I need to separate the build of the different libraries, to their separate projects, respectively: libA, libB and C.aar.
How is it done without the IDE (and via command-line)?
There's the stand-alone NDK, the make_standalone_toolchain.py script, android.toolchain.cmake and other options, but none are documented or up-to-date. Most documentation still talks about the outdated Android.mk methodology.
I'd presume including android.toolchain.cmake in my CMakeList.txt, which will set all needed environment...
I'm using the newest Android Studio 3.0.1 and NDK r16b (installed via SDK Manager)
Alex - thanks, exactly what I was looking for. Just had to add a few flags and a call to make:
> cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=%ANDROID_NDK%\build\cmake\android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=android-19 -DCMAKE_MAKE_PROGRAM=%ANDROID_NDK%\prebuilt\windows-x86_64\bin\make.exe -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="armeabi-v7a with NEON" ..
> cmake --build .
Android Studio (the standard Android gradle plugin, that is) does not support native-only modules, but you can split your CMake script and work with libA and libB separately. You can run cmake from command line (but better use the version that is shipped with Android SDK).
sdk/cmake/3.6.4111459/bin/cmake -DCMAKE_TOOLCHAIN_FILE=sdk/ndk-bundle/build/cmake/android.toolchain.cmake ...
The easiest way to build the AAR file that includes a compiled Java wrapper and the two native libraries would be with Android Studio, but you can run the gradle task from command line. This is what we typically do on a build server.

Change target sdk on Phonegap for nodejs

Im using phonegap on nodejs, but when I use the command
phonegap local build android
It automatically ask me for "Android 4.2 SDK"
Please install Android target 17 (the Android 4.2 SDK). Make sure you
have the latest Android tools installed as well.
How can I choose a lower vesion (android 4.1) of the sdk using phonegap for nodejs?
Short answer: you don't have to!
I struggled with this until I installed v17 and completed my first build. It turns out that the generated Androidmanifest.xml has minSdkVersion=10, so the minimum version required for your application is 2.3.3, it just needs to compile against v17.

Resources