Java No Class Def Found error

0 votes

Android thing run time exception:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/things/pio/PeripheralManager;

Manifest file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.androidthings.simplepio">

    <application android:allowBackup="true" android:icon="@android:drawable/sym_def_app_icon"
        android:name="android.support.multidex.MultiDexApplication"
        android:label="@string/app_name">
        <uses-library android:name="com.google.android.things"/>
        <activity android:name=".BlinkActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <!-- Launch activity automatically on boot -->
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.IOT_LAUNCHER"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
    </application>

</manifest>
This is my code, I got this from this Link, I just clone it nothing changed.

Error logcat:

    01-01 00:00:53.293 1326-1326/com.example.androidthings.simplepio E/AndroidRuntime: FATAL EXCEPTION: main
   Process: com.example.androidthings.simplepio, PID: 1326
   java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/things/pio/PeripheralManager;
       at com.example.androidthings.simplepio.BlinkActivity.onCreate(BlinkActivity.java:51)
       at android.app.Activity.performCreate(Activity.java:7000)
       at android.app.Activity.performCreate(Activity.java:6991)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
       at android.app.ActivityThread.-wrap11(Unknown Source:0)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Native Method)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
    Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.things.pio.PeripheralManager" on path: DexPathList[[zip file "/system/framework/com.google.android.things.jar", zip file "/data/app/com.example.androidthings.simplepio-y-kMOBHPpOQbWFdWf4QeXw==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.androidthings.simplepio-y-kMOBHPpOQbWFdWf4QeXw==/lib/arm, /system/lib, /vendor/lib]]
       at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
       at com.example.androidthings.simplepio.BlinkActivity.onCreate(BlinkActivity.java:51) 
       at android.app.Activity.performCreate(Activity.java:7000) 
       at android.app.Activity.performCreate(Activity.java:6991) 
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) 
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731) 
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
       at android.app.ActivityThread.-wrap11(Unknown Source:0) 
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
       at android.os.Handler.dispatchMessage(Handler.java:106) 
       at android.os.Looper.loop(Looper.java:164) 
       at android.app.ActivityThread.main(ActivityThread.java:6494) 
       at java.lang.reflect.Method.invoke(Native Method) 
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
       at com.android.internal.os.ZygoteInit.main(ZygoteIncode,807) 
    01-01 00:00:53.446 1326-1326/com.example.androidthings.simplepio I/Process: Sending signal. PID: 1326 SIG: 9
Please help me in solving this problem.
Oct 8, 2018 in IoT (Internet of Things) by Matt
• 2,260 points
119 views

1 answer to this question.

0 votes

I solved this issue by updating my Android Things. I used the new setup utility tool to flash my Android Things: https://partner.android.com/things/console/u/1/#/tools

answered Oct 8, 2018 by anonymous2
• 4,260 points

Related Questions In IoT (Internet of Things)

0 votes
1 answer

Publishing commands to device in IBM IoT using MQTT in Java

If you are publishing from an application, ...READ MORE

answered Jul 27, 2018 in IoT (Internet of Things) by anonymous2
• 4,260 points
374 views
0 votes
1 answer
0 votes
1 answer

AWS IoT SDK - main L#206 Error subscribing : -28 (C code)

As I did not find out a ...READ MORE

answered Aug 1, 2018 in IoT (Internet of Things) by anonymous2
• 4,260 points
60 views
0 votes
1 answer

AttributeError: 'module' object has no attribute 'Serial'

I see where the problem is. I ...READ MORE

answered Aug 14, 2018 in IoT (Internet of Things) by DataKing99
• 8,100 points
1,143 views
0 votes
1 answer

Downloading source code of Android Things

No because AndroidThings is still in preview ...READ MORE

answered Jul 5, 2018 in IoT (Internet of Things) by anonymous2
• 4,260 points
400 views
0 votes
1 answer

Creating Android Things' bundle and pushing it over OTA

Here are all the steps necessary to ...READ MORE

answered Jul 6, 2018 in IoT (Internet of Things) by anonymous2
• 4,260 points
35 views
0 votes
1 answer

Problem while disconnecting BLE device!

I think that's because of the way ...READ MORE

answered Jul 17, 2018 in IoT (Internet of Things) by nirvana
• 3,060 points
211 views
0 votes
1 answer
0 votes
1 answer

MQTT protocol connection error

Ok so you need two libraries to ...READ MORE

answered Jul 6, 2018 in IoT (Internet of Things) by anonymous2
• 4,260 points

reshown Jul 6, 2018 by Vardhan 344 views
0 votes
1 answer

Android AllJoyn: Connection with second machine gives error of BusAttachement

Why dont you create two Interfaces, one ...READ MORE

answered Jul 25, 2018 in IoT (Internet of Things) by anonymous2
• 4,260 points
24 views