6

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 find class 'android.os.PersistableBundle referenced from method com.example.jack.test1.MainActivity.access$super', Could not find class 'android.app.SharedElementCallback referenced from method com.example.jack.test1.MainActivity.access$super', Could not find class 'android.app.ActivityManager$TaskDescription.

The app still runs normally but when it comes to running a certain button event, it stops working. My friend has the same exact code as I do but in my case it doesn't work. I have tried upgrading to a latest API level and tried different gradle plugin version but the problem persisted. Thanks

running android studio 2.0
gradle version 2.10
min sdk 4.0

4 Answers 4

2

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.

2
  • hey @MandisaW, could you please help me regarding removal and updation of libraries ? Aug 7, 2016 at 9:55
  • Try going to the File > Project Structure... window. There should be a list on the left, with your app modules at the bottom of the list. For instance, my main module is 'app'. Click on your main module, then there should be several tabs in the window - you want 'Dependencies'. From there it's a standard + (add) / - (remove) list. Android Support libraries are addes as "Library Dependency", and any user-created libraries are added as "Module Dependency". Hope that helps.
    – MandisaW
    Aug 8, 2016 at 17:12
0

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

1
  • Thanks for the tip, altough i copied exactly my friend's build.gradle file(app) synced it but for some reason still remained the problem :/
    – Jack Smith
    Apr 24, 2016 at 10:49
0

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

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.