Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoClassDefFoundError: WearableActivityController$AmbientCallback; #574

Open
Stardust077 opened this issue Feb 18, 2021 · 1 comment
Open

Comments

@Stardust077
Copy link

Hello,

I am completely new to Android development and wanted to use ActiveAndroid in my app.
I tried to install it following the documentation, like this:

`

<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-feature android:name="android.hardware.type.watch" />

<application

    ...

    android:name="com.activeandroid.app.Application"
    >

    <meta-data android:name="AA_DB_NAME" android:value="cardelli_db" />
    <meta-data android:name="AA_DB_VERSION" android:value="5" />

    ...

   
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:theme="@style/Theme.InventoryManagement.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

`

I also dragged the .jar to my libs folder and imported the library. Android Studio finds the annotations when I try to use them.

However, when I start the app, I get a "NoClassDefFoundError". Please see below

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.inventorymanagement, PID: 26940
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/wearable/compat/WearableActivityController$AmbientCallback;
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at com.activeandroid.ReflectionUtils.getParsers(ReflectionUtils.java:158)
at com.activeandroid.Registry.initialize(Registry.java:100)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:8)
at com.activeandroid.app.Application.onCreate(Application.java:9)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6712)
at android.app.ActivityThread.access$1300(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.wearable.compat.WearableActivityController$AmbientCallback" on path: DexPathList[[zip file "/data/app/~~9pvbFFebYtBtO7MtdDhYbA==/com.example.inventorymanagement-I8glsXyrufwz-48YcKB0QQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~9pvbFFebYtBtO7MtdDhYbA==/com.example.inventorymanagement-I8glsXyrufwz-48YcKB0QQ==/lib/x86, /system/lib, /system_ext/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at java.lang.Class.classForName(Native Method) 
at java.lang.Class.forName(Class.java:454) 
at com.activeandroid.ReflectionUtils.getParsers(ReflectionUtils.java:158) 
at com.activeandroid.Registry.initialize(Registry.java:100) 
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:8) 
at com.activeandroid.app.Application.onCreate(Application.java:9) 
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6712) 
at android.app.ActivityThread.access$1300(ActivityThread.java:237) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:223) 
at android.app.ActivityThread.main(ActivityThread.java:7656) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 
I/Process: Sending signal. PID: 26940 SIG: 9

It looked like a dependency is missing. "AndroidActivityController" is appearently part of AndroidWear. I tried adding the dependency stated there by adding "implementation "androidx.wear:wear:1.2.0-alpha03"" to my build.gradle, but no help.

I searched on the web for this but could not find anything. Any help is much appreciated!

Best regards.

@azizimusa
Copy link

Do you add ActiveAndroid into proguard?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants