Updated android studio and got fail with Gstreamer build
Asked Answered
R

2

5

Updated to Android Studio 3.0.0 with new android gradle plugin. While buildin project got message:

What went wrong:
Execution failed for task `':app:externalNativeBuildDebug'`.

Expected output file at `gst-build-arm64-v8a/libgstreamer_android.so` for target `gstreamer_android` but there was none

but libgstreamer_android.so library file is already there. For native code I use ndk-build. Does anyone have this issue?

Risley answered 1/11, 2017 at 9:12 Comment(2)
I'm having exact the same problem and I'm trying to figure it out... I already tried to use gradle 4.3 instead of 4.1, clean, rebuild, re-link the project... I guess I will try downgrade the android plugin 3.0 while i don't find a better solutionUpcoming
@EduardoFernando, look at my answer, please.Risley
R
7

Add to build.gradle file of our android module field targets.

android { 
  defaultConfig { 
    externalNativeBuild { 
      ndkBuild { 
        targets "name_of_native_module_in_android_mk_file" 
      } 
  ... 
}

Don't add gstreamer_android.

Risley answered 4/12, 2017 at 12:4 Comment(2)
I have some questions... First: It's on (build.grade Module:app) rigth? Second: My externalNativeBuild{ } is not inside defaultConfig { }... it's on android { }... Should I erase it from android{ } and put it on android{ defaultConfig{ } } ?? Third: Inside externalNativeBuild{ndkBuild{ } } there's "path 'src/main/jni/Android.mk'" Should I keep it there or erase do only add the command with "targets" ? Forth: What's and where's the "name_of_native_module_in_android_mk_file" ? Is it in "LOCAL_MODULE" variable?Upcoming
@EduardoFernando, 1. in model with gstreamer usage. 2. externalNativeBuild in application hold path to Android.mk file, externalNativeBuild in default config I described targets (native modules) and abi filters. I hope it will help. youRisley
U
0

UPDATE: Valery's answer works!

Obsolete answer:
That's not the perfect fix, it's just temporary until I have time to take a deep look into the problem.
Downgrade your gradle plugin:

  1. File -> Project Structure
  2. Click at "Project"
  3. At "Gradle version" field put:
    • 3.3
  4. At "Android Plugin Version" field put:
    • 2.3.3
  5. Hit "OK"

Accept the messages, sync the project, etc... Android Studio may prompt a windown asking for update gradle plugin again, just don't accept it for now...
I guess the update on gradle changed the way the builds are made, maybe something on Android.mk will have to change or some other parameter on build.grade...

edit: I found some clue at: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html

API changes
Android plugin 3.0.0 introduces API changes that removes certain functionalities and may break your existing builds. Later versions of the plugin may introduce new public APIs that replace broken functionalities.

Modifying variant outputs at build time may not work Using the Variant API to manipulate variant outputs is broken with the new plugin. It still works for simple tasks, such as changing the APK name during build time, as shown below:...

So, I guess we should keep using the temporary fix (not updated version of gradle)...

Upcoming answered 2/11, 2017 at 19:5 Comment(1)
I've found *.so files, lying at app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/*.so, but dont know how to use them while building projectRisley

© 2022 - 2024 — McMap. All rights reserved.