Android Studio E/dalvikvm: Could not find class… referenced from method

前端 未结 4 1710
一个人的身影
一个人的身影 2020-12-19 08:22

I encountered a problem that seems to have something to do with the libraries in android studio.
I am having compiling errors like:

Could not fi

相关标签:
4条回答
  • 2020-12-19 08:28

    I have faced same issue. The issue is because of difference between android build tools version and the android support library(appcompat) version.

    You can resolve this issue by, Either update your build tool version and support library version to latest or you should use a appcompat library that is lower than the build tools version and change it in your gradle file.

    You can get all the revisions of the support library from here

    For getting and updating your build version and support library version please check build.gradle file inside your app module

    0 讨论(0)
  • 2020-12-19 08:39

    What I think solved the issues for me (after trying above suggestions) Shrink the code and use progaurd rules explained officially here

    As I am novice to Android Studio, felt that my project, though a very small app, might be inflated by multiple experimental library inclusions + so many comments(and inactive code inside) causing 64K?(nopeIguess),illegitimate references(possibly!); just a intuitive guess after reading answer by @PKuijpers(thanks!). And honestly I didn't wanted to include multiDex because after also reading official document, I was sure that my app is not PokemonGo or NFS or big enough to qualify for multidex.

    0 讨论(0)
  • 2020-12-19 08:40

    I got this error in Android Studio v2.0 while building an empty child of AppCompatActivity from the (v7-appcompat) Support Library. Seems like the problem occurred when the Build Tools (Gradle v2.1.0, Android plugin v2.10) were upgraded after the corresponding support library upgrade (v23.3.0).

    My solution:

    • Remove the support-library dependency reference from my module-level build.gradle file(s)
    • Clean the Project
    • Restart Android Studio (possibly optional)
    • Add the support-library back via Project Structure > Dependencies

    Seems to be working so far, although in future it would be nice to be able to specify an upgrade-order, or set up some kind of happens-before hierarchy for libraries/settings that are dependent on Build Tools.

    0 讨论(0)
  • 2020-12-19 08:45

    Enabling Multidex solved the problem for me. More detailed explanation can be found at my answer on a similar question over here.

    0 讨论(0)
提交回复
热议问题