1

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:

enter image description here

Does anyone know how to solve this and run the app?

1 Answer 1

1

Original author of the build.gradle script here. As you can probably tell, our gradle build is pretty messy. It consists of three steps:

  1. Build the Halide generators using gradle's native "cpp" plugin. That is, they're just regular C++ programs.
  2. Run each Halide generator with per-architecture arguments to generate a set of .so files in the appropriate jni/libs/ directory.
  3. 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).

5
  • I built the native C++ portion of the script using the tutorial here, which is quite out of date (Gradle 1.2.2 only, before they moved to the component model).
    – stuyguy
    Aug 30, 2016 at 19:13
  • Once Android Studio 2.2 proper is released, I will see if it is possible to replace the Component Model with an officially supported cmake based native build.
    – stuyguy
    Aug 30, 2016 at 19:16
  • I have another problem now. I read in the code that i need some includes, but the binary relsese i downloaded from the front page doesn't contain all the files it needs. For example: LINK : fatal error LNK1181: cannot open input file 'C:\\workspace\\Halide-master\\apps\\HelloAndroid/../../bin.obj' :linkHalide_generatorExecutable FAILED
    – dspmihai
    Aug 31, 2016 at 8:48
  • I haven't seen that exact error but I think I know what the problem is. Depending on whether you downloaded the entire Halide tree from source or downloaded a binary distribution, and whether you compiled using Make or CMake, the Halide dependencies may be located in different paths. It seems that your build failed on the first step - in linking to produce one of the generators. Look through build.gradle for instances of ${projectDir} and change them to what they should be. the "println" function should help you debug what the variables are.
    – stuyguy
    Sep 1, 2016 at 17:26
  • Hello, may I know what is the highest version of Android Studio that supports the HelloCamera2? Is that example app still maintained? I am trying to use Halide in my Android App for fast image processing performance, but I don't know where to start other than those two demo apps. However, I am having trouble building those two demo apps
    – Tom Xuan
    Jun 1, 2021 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.