question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stetho crashes failing to find com/facebook/litho/annotations/Prop

See original GitHub issue

Issues and Steps to Reproduce

Follow getting started and the tutorial to the second part.

Insert this code in your Application class to enable Stetho.

  public void onCreate() {
    super.onCreate();

    Stetho.initialize(
            Stetho.newInitializerBuilder(this)
                    .enableWebKitInspector(new LithoWebKitInspector(this))
                    .build());

    SoLoader.init(this, false);
  }

And have a build.gradle dependencies like this:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'

    // Litho
    compile 'com.facebook.litho:litho-core:0.2.0'
    compile 'com.facebook.litho:litho-widget:0.2.0'
    provided 'com.facebook.litho:litho-annotations:0.2.0'

    annotationProcessor 'com.facebook.litho:litho-processor:0.2.0'

    // SoLoader
    compile 'com.facebook.soloader:soloader:0.2.0'

    // Optional
    // For debugging
    debugCompile 'com.facebook.litho:litho-stetho:0.2.0'

    // For integration with Fresco
    compile 'com.facebook.litho:litho-fresco:0.2.0'
}

Run Stetho and navigate to ListItemSpec.

The app crashes saying it cannot find com/facebook/litho/annotations/Prop.

Expected Behavior

The app should not crash and Stetho should show ListItemSpec.

Link to Code

The exception is:

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.user.lithoexample, PID: 25176
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/litho/annotations/Prop;
   at com.facebook.litho.ComponentStethoNodeDescriptor.onGetStyles(ComponentStethoNodeDescriptor.java:193)
   at com.facebook.litho.ComponentStethoNodeDescriptor.onGetStyles(ComponentStethoNodeDescriptor.java:26)
   at com.facebook.stetho.inspector.elements.AbstractChainedDescriptor.getStyles(AbstractChainedDescriptor.java:154)
   at com.facebook.stetho.inspector.elements.Document.getElementStyles(Document.java:153)
   at com.facebook.stetho.inspector.protocol.module.CSS$2$1.store(CSS.java:144)
   at com.facebook.litho.ComponentStethoNodeDescriptor.onGetStyleRuleNames(ComponentStethoNodeDescriptor.java:152)
   at com.facebook.litho.ComponentStethoNodeDescriptor.onGetStyleRuleNames(ComponentStethoNodeDescriptor.java:26)
   at com.facebook.stetho.inspector.elements.AbstractChainedDescriptor.getStyleRuleNames(AbstractChainedDescriptor.java:145)
   at com.facebook.stetho.inspector.elements.Document.getElementStyleRuleNames(Document.java:147)
   at com.facebook.stetho.inspector.protocol.module.CSS$2.run(CSS.java:118)
   at com.facebook.stetho.common.android.HandlerUtil$2.onRun(HandlerUtil.java:90)
   at com.facebook.stetho.common.android.HandlerUtil$2.onRun(HandlerUtil.java:87)
   at com.facebook.stetho.common.android.HandlerUtil$WaitableRunnable.run(HandlerUtil.java:109)
   at android.os.Handler.handleCallback(Handler.java:739)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:135)
   at android.app.ActivityThread.main(ActivityThread.java:5254)
   at java.lang.reflect.Method.invoke(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:372)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.litho.annotations.Prop" on path: DexPathList[[zip file "/data/app/com.example.user.lithoexample-2/base.apk", zip file "/data/app/com.example.user.lithoexample-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.user.lithoexample-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.user.lithoexample-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.user.lithoexample-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.user.lithoexample-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.user.lithoexample-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.user.lithoexample-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.user.lithoexample-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.user.lithoexample-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.user.lithoexample-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.user.lithoexample-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.user.lithoexample-2/lib/arm, /vendor/lib, /system/lib]]
...
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
passycommented, May 2, 2017

This is actually only needed as temporary workaround. If you build from litho master then this won’t happen any longer.

We’ll try to get a 0.2.1 release out soon to address this. Thanks for bringing this to our attention!

1reaction
mmm111mmmcommented, May 2, 2017

Can confirm this works when I change provided to compile with the current version of litho, 0.2.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Index - Litho
AccessibilityRoleType - Annotation Type in com.facebook.litho ... When static cache gets corrupted, next time instance is used it can crash with ...
Read more >
Index - Litho
Whenever a Spec sets tree props, the TreeProps map from the parent is copied. ACQUIRE_STATE_HANDLER_ON_RELEASE - Static variable in class com.facebook.litho.
Read more >
Untitled
List of religions that celebrate christmas, Syringaldazine structure, Capital city dance and fitness, Flexo litho pte ltd, Oakland park flea market stores, ...
Read more >
sitemap.xml - ProAndroidDev
... .com/configuring-android-project-static-code-analysis-tools-b6dd83282921 ... monthly 0.7 https://proandroiddev.com/facebook-litho-review-b591372d85be ...
Read more >
UPA One Liner Detail - OSHA
An employee was in a motor vehicle accident at the worksite when his motor ... Employees are unable to distance due to configuration...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found