androidthings / sample-nativepio

Basic Peripheral I/O examples in C/C++ with Android Things
Apache License 2.0
48 stars 67 forks source link

Runtime Issue on Raspberry PI #3

Open brtietz opened 6 years ago

brtietz commented 6 years ago

I've tried to test the Native PIO speaker example on a Raspberry PI and got the following runtime error:

java.lang.IllegalArgumentException: Unable to find native library speaker using classloader: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/com.google.android.things.jar", zip file "/oem/app/speaker-debug.apk"],nativeLibraryDirectories=[/oem/lib/speaker-debug, /system/lib, /vendor/lib, /system/lib, /vendor/lib]]]

This is similar to errors we've seen compiling other armeabi-v7a libraries for the PI. Has anyone had success using those libraries on the PI, or is there an arm64-v8a version of the native libraries available?

proppy commented 6 years ago

Can you provide the full build log and dump the content of the apk?

brtietz commented 6 years ago

Build logs were generated with gradle assembleDebug -d > build_logs

build_logs.log

Here is the dump of the apk:

aapt list -a speaker-debug.apk
AndroidManifest.xml
META-INF/CERT.RSA
META-INF/CERT.SF
META-INF/MANIFEST.MF
classes.dex
lib/armeabi-v7a/libspeaker.so
lib/x86/libspeaker.so
resources.arsc

Resource table:
Package Groups (1)
Package Group 0 id=0x7f packageCount=1 name=com.example.androidthings.nativepio
  Package 0 id=0x7f name=com.example.androidthings.nativepio
    type 0 configCount=1 entryCount=1
      spec resource 0x7f010000 com.example.androidthings.nativepio:string/app_name: flags=0x00000000
      config (default):
        resource 0x7f010000 com.example.androidthings.nativepio:string/app_name: t=0x03 d=0x00000000 (s=0x0008 r=0x00)

Android manifest:
N: android=http://schemas.android.com/apk/res/android
  E: manifest (line=17)
    A: android:versionCode(0x0101021b)=(type 0x10)0x1
    A: android:versionName(0x0101021c)="1.0" (Raw: "1.0")
    A: package="com.example.androidthings.nativepio" (Raw: "com.example.androidthings.nativepio")
    E: uses-sdk (line=22)
      A: android:minSdkVersion(0x0101020c)=(type 0x10)0x1a
      A: android:targetSdkVersion(0x01010270)=(type 0x10)0x19
    E: application (line=26)
      A: android:label(0x01010001)=@0x7f010000
      A: android:icon(0x01010002)=@0x1080093
      A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
      A: android:allowBackup(0x01010280)=(type 0x12)0xffffffff
      A: android:extractNativeLibs(0x010104ea)=(type 0x12)0x0
      E: uses-library (line=32)
        A: android:name(0x01010003)="com.google.android.things" (Raw: "com.google.android.things")
      E: activity (line=34)
        A: android:name(0x01010003)="android.app.NativeActivity" (Raw: "android.app.NativeActivity")
        E: meta-data (line=35)
          A: android:name(0x01010003)="android.app.lib_name" (Raw: "android.app.lib_name")
          A: android:value(0x01010024)="speaker" (Raw: "speaker")
        E: intent-filter (line=39)
          E: action (line=40)
            A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
          E: category (line=42)
            A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
        E: intent-filter (line=46)
          E: action (line=47)
            A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
          E: category (line=49)
            A: android:name(0x01010003)="android.intent.category.IOT_LAUNCHER" (Raw: "android.intent.category.IOT_LAUNCHER")
          E: category (line=50)
            A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT")

A few other notes. We've been working with the Google Group on this: https://plus.google.com/105079131213722093844/posts/bmf3aBDpgBd?cfem=1 https://issuetracker.google.com/issues/73122473

We had to add android:extractNativeLibs="false" to the manifest. After that it worked if we loaded directly from Android Studio. However, we have not yet been able to build from command line gradle and load via an OTA update, as a test of a production-like process.