Halide HelloAndroid import method not found - halide

I tried to import HelloAndroid project in Android Studio, but, when i try to build the apk and run it on a device, i get a gradle error:
Does anyone know how to solve this and run the app?

Original author of the build.gradle script here. As you can probably tell, our gradle build is pretty messy. It consists of three steps:
Build the Halide generators using gradle's native "cpp" plugin. That is, they're just regular C++ programs.
Run each Halide generator with per-architecture arguments to generate a set of .so files in the appropriate jni/libs/ directory.
Shell out to the ndk-build script to compile Android.mk, which links the JNI portion of the app with the Halide-generated .so files.
The process is brittle, especially with both Gradle and the Android platform changing under us. I've been waiting for the platform to stabilize with the new Gradle Component Model that is still "incubating" as well as the New Android Build System and New Experimental Plugin.
In the meantime, everything should still build if you use Android Studio 1.5 and Gradle 1.2.2 (1.2.3 will probably work, but IIRC 1.2.4 is broken).

Related

Unable to find Groovy method when building Rhino with Intellij IDEA

While trying to build https://github.com/mozilla/rhino, I'm getting Unable to find method on org.codehaus.groovy.runtime.StringGroovyMethods.
so the build fails, and I'm unable to test Rhino built from source code, which is the goal.
Steps Taken
From the opening screen in IntelliJ, I check out the project:
I get this error Unable to find method ''java.lang.String org.codehaus.groovy.runtime.StringGroovyMethods.capitalize(java.lang.String)'' right away, which I have not been able to fix:
There are two suggestions in the above Re-download dependencies and sync project and Stop Gradle build processes. I have tried both with no improvement.
When I look at the build.gradle file, I see another suggestion ...configure Gradle wrapper to use distribution with sources.... This also does not get past the missing Groovy method problem.
I have looked on S.O. for similar issues and tried various things under File > Settings > Build, Execution, Deployment, but I realized I'm over my head since, conceptually, I'm not sure what I need and where that would go in the settings.
The command line items from the readme work as expected, but going back to File > Build still fails (added after tim_yates comment).
What changes are required to the IDE or to the build definitions to allow Mozilla Rhino to build properly?
I installed the latest (2022.1) version of IntelliJ IDEA Community Edition. During the install, it asked if you wanted this IDE to be associated with Groovy file types, and I answered in the affirmative.
On this new install, the Unable to find method on org.codehaus.groovy.runtime.StringGroovyMethodserror did not appear, so the problem was solved by upgrading the IDE (and also that required updating GIT).

How to add system api classes to your android project for non AOSP builds

I have an android system app that is currently being built with the android build system. The SDK in use is system_current as it uses some system apis.
For external dependency reasons, ease of development, debugging etc, it would be nice to move this app to Android Studio and use Gradle to build.
Converting the sources to build with Gradle is straight forward enough. However, at build time, the system APIs are not found as those are not available in the normal SDK. I thought that by generating the SDK from the AOSP sources I'd get an SDK I could use, but that target output seems to also not have the System APIs available.
How would I change my gradle build to be able to use the System SDK to compile against?
There are two ways depending if you are only trying to use current non-public APIs, or of you've added custom ones yourselves and are trying to access those.
If you're only trying to use current system-level APIs, you can use android.jar from this repository https://github.com/anggrayudi/android-hidden-api
If you have added some new method that isn't part of standard AOSP, then it's a but more work.
The reason that all methods don't show as part of Android SDK is that in AOSP code they are annotated with #hide. This means that when SDK is generated, they are exlcuded.
You'll need to remove that annotation for the methods that you want to use. Then you'l need
Run make update-api to update the public API of the project.
Make the Android SDK from code by following: https://android.googlesource.com/platform/sdk/+/master/docs/howto_build_SDK.txt
Change the Android SDK path in Android Studio to use the custom one you build.
There's also the possibility of accessing methods via reflection on runtime without SDK generation. It's slower and messier to code though.
Not sure I understand exactly what you mean by normal SDK etc.
From https://developer.android.com/studio/build
The key part is to have a
apply plugin: 'com.android.library'
...
android {
...
}
If on the other hand you wanted to build with a desktop JDK but compile against java APIs you could add a dependency on robolectric and you can get a jar you can import into another Android project.
implementation "org.robolectric:android-all:11-robolectric-6757853"
Android Studio isn't really designed to work with System APIs. Even if you make Gradle build your platform app, you will also need to sign it with the same certificate as your AOSP build (so that you could run it). As you noticed, if you decide to use Roboelectric you would also need to modify it yourself to match your current AOSP version (System APIs are not as stable as Public APIs and Roboelectric needs to constantly chase all the changes).
I would suggest to keep using the AOSP build system but optimize our workflow.
Ease of development
Doing a full build/flash for every change in your component must be a pain. But if you are just modifying a single app, you can get away with just building that single component:
~/aosp/ $ m -j -- do a full build first
flash a clean image (with your platform certificate)
~/aosp/path/to/your/app/ $ mma -j -- build your app with all dependencies after you made changes
$ adb root && adb remount && adb sync
Basically, adb sync works great if you don't touch any APIs or parts of Android Framework (which would cause a rebuild of thousands other objects). If you see adb sync updating more than handful of files, you'll likely end up with a bad system and need to do a full flash.
Debugging
While Android Studio is a to-go solution for regular apps, framework and the platform apps go with InteliJ (you can probably use Android Studio, but there won't be much of use of Android plugins on top InteliJ) plus some configuration (see idegen.sh - example).

Is there a way to build the same JavaFX app to a .exe with different build types?

I need to build a javafx aplication to a .exe file, to be used in 3 differents enviroments.
Now, before I build the application to each different enviroment I am changing every variable manualy, like urls, versions and tokens. I know that is a matter of time until I upload the wrong version to the wrong enviroment, so I really need a more automatic process to manage each version.
I read something about maven build profiles but i do not find a way to integrate this in the building of the exe file
This javaFx app is using maven and java10
To build the java code to an exe, I'm using Intellij
Thank you in advance
The big problem is that java 10 is end of lifetime (EOL), so you should already work with java 11, this however is a little more complicated since JavaFx/OpenJfx is now separated. (see https://openjfx.io/)
Anyway to solve your complex needs you should think about a CI platform like as example gitlab CI.
This platforms (with the help of Docker Images) give you the tools you need to properly build and configure complex javaFX build targets and configurations.
But you have to build the .exe file on your own with tools like exe4j if you choose this path.
Side Tips:
In my experience is a lot more easy to build java 11 applications
with gradle instend of just maven since you gain a lot more
flexiblity to solve complex problems
If you stay on java 10 it would be much easier since Java11 + Openjfx
11 required OS dependend builds. (but as I sayed it is EOL)

Is there a reason to install Gradle instead of using gradlew?

The recommended way to use Gradle is through the Gradle Wrapper, (gradlew), which is checked into version control of the project.
My question is: is there any reason to install Gradle myself from http://www.gradle.org/downloads instead of using the wrapper everywhere? (and copying the wrapper to new projects from an older project)
If You work with gradle occasionally (not with one particular project (or a set of projects)) it's very useful to have gradle installed on command line. Then You can easily create a script and check if it works fine. With gradle installed on CL it's very easy and fast (no need to download the whole distribution every time). Beside this one particular use case nothing else comes to my head.
P.S. There's a great tool for gradle (and other tools) version management: GVM.

How do I set up an external build tool (make) within XCode3?

I've used XCode4 for a large C++ project. The project uses make for build. I've set up XCode4 to use external build tool make so that my Makefile is called each time I hit build and I see compile errors nicely within XCode.
First, this worked OK but recently XCode4 crashes a lot. Now I am switching back to XCode3 but I cannot find out how to set up build using an external build tool in XCode 3.2.5.
I'm not sure if this is what you are looking for, but when I'm ready to build an external static framework I use a bunch of scripts I have written and you can see at my Github repo. Look in the scripts directory and at the build.sh which configures and calls them.
I've used these scripts on both XCode 3 and XCode 4. They make use of xcodebuild and a couple of external tools such as appledoc and produces a distributable (versioned) DMG file if successful.
You can use these scripts if you like or just take a look to see how they work and get ideas for your own.

Resources