Android Studio E / dalvikvm:无法找到类...从方法引用 [英] Android Studio E/dalvikvm: Could not find class... referenced from method

查看:440
本文介绍了Android Studio E / dalvikvm:无法找到类...从方法引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个似乎与android studio中的库有关的问题。

我有编译错误,如:

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


无法找到从方法com.example.jack.test1.MainActivity.access $ super'引用的类'android.os.PersistableBundle,找不到从方法com引用的类'android.app.SharedElementCallback。 example.jack.test1.MainActivity.access $ super',找不到类'android.app.ActivityManager $ TaskDescription。

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.

应用程序仍然正常运行但是当运行某个按钮事件时,它会停止工作。我的朋友和我的代码完全相同,但在我的情况下,它不起作用。我已经尝试升级到最新的API级别并尝试了不同的gradle插件版本,但问题仍然存在。谢谢

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

运行android studio 2.0

gradle版本2.10

min sdk 4.0

running android studio 2.0
gradle version 2.10
min sdk 4.0

推荐答案

我在Android Studio v2.0中遇到此错误,同时从(v7-appcompat)支持库构建AppCompatActivity的空子。似乎在相应的支持库升级(v23.3.0)之后构建工具(Gradle v2.1.0,Android插件v2.10)升级时出现的问题。

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).

我的解决方案:


  • 从我的模块中删除支持库依赖项引用-level build.gradle文件

  • 清理项目

  • 重启Android Studio(可选)

  • 通过项目结构>依赖关系添加支持库

  • 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.

这篇关于Android Studio E / dalvikvm:无法找到类...从方法引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆