googlearchive / tango-examples-c

JNI example projects for Project Tango [deprecated] C-API
https://developers.google.com/ar
Apache License 2.0
337 stars 204 forks source link

Android 7.0+ linking to private platform libraries #117

Open SimonScholl opened 6 years ago

SimonScholl commented 6 years ago

After we got our ASUS Zenfone AR we recognized, that warnings were generated caused by the changes to the access of private ndk libraries in future android releases. screenshot_20170908-092316 Not only our own application is triggering this warning also every example project. Beside this annoying dialog, we want that our application runs also with future android releases.

The guide provided here: https://developer.android.com/about/versions/nougat/android-7.0-changes.html#ndk was not very helpful. "You should update your app to include its own copy of those libraries " - from my unexperienced perspective i don't know how to get a copy of those libraries. Additionally i should say that we use cmake as a build tool, but like said, the warning dialog appears also with the examples which are build with ndk-build tool.

Maybe anyone knows how to get this working, cause other tango applications from the store don't trigger this dialog.

andersgb commented 6 years ago

I have the exact same problem. Getting the logcat warnings is OK for now (until the tango libraries are made properly Android N compatible), but how can I prevent the annoying dialog box?

andersgb commented 6 years ago

It seems like the popup disappears when compiling in Release mode.

SimonScholl commented 6 years ago

Thank you for your feedback, can you provide more information if your are using cmake or ndk-build? And where you defined this release mode? (Android Studio, Gradle) Cause i also set the CMAKE_BUILD_TYPE on 'Release' and nothing changed.

Additionally i was able to create a workaround based on a stackoverflow response. https://stackoverflow.com/questions/46112418/tango-api-linking-against-private-native-libraries-api24/46181422#46181422 But it is more a dirty hack then a good solution, i copied the prebuilt shared private native libs via ADB from my ASUS (located in system/lib and system/lib64) and included them into my APK.

EDIT: I tried generating a signed APK and no warning appears, but it is questionable if this will work for further API version 24+. How we can secure that our application includes all dependencies?

andersgb commented 6 years ago

I also use cmake, I set release mode through Android Studio. My build.gradle targets API 23 like this:

defaultConfig {                                                                                                                                                                                                                                                                                                            
        minSdkVersion 21                                                                                                                                                                                                                                                                                                                     
        targetSdkVersion 23
}

It might be the signed APK that is important here, as you say, not the compiling in Release mode.

I have not made any efforts trying to support API level 24+, I am hoping a future release of libtango_client_api.so will be made properly Android N compatible.