Android Studio import包后就报错,是因为JDK版本问题

报错:

Error:Error converting bytecode to dex:

Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add 
targetCompatibility = '1.7'
sourceCompatibility = '1.7'

to that submodule's build.gradle file.

解决办法:

在project下的build.gradle改成这样:

buildscript {    repositories {        jcenter()    }    dependencies {        classpath 'com.android.tools.build:gradle:2.1.0'        apply plugin: 'java'        sourceCompatibility = 1.7        targetCompatibility = 1.7    }}
在app文件夹下的build.gradle改成这样:


更多相关文章

  1. Android版本检测与更新
  2. android获取versionName和versionCode
  3. android studio 用cmake编译报错
  4. android分享应用工具类
  5. 【Android】高德地图2DMap,隐藏“高德地图”logo样式(不同版本或有
  6. Android(安卓)Glide 升级4.8 后, 原方法error/preload/fallback
  7. android版本自动检测更新 版本检测 自动更新 自动安装
  8. 同一功能在Android不同版本进行兼容的方法
  9. android EditText的自动换行和对Enter键的改变

随机推荐

  1. Android Studio在连接手机时候,出现"Inst
  2. 跟核心虚拟机Dalvik说再见 Android Runti
  3. 实现微信布局的四种方式(一)
  4. Android防止活动被回收而丢失数据
  5. [置顶] Android获取存储卡路径的
  6. 关于Android Studio 3.1.3
  7. Android公钥私钥及代码详细解读
  8. 关于Android的阅读界面设计问题
  9. android 中的 odex 文件
  10. Android实现非本地图片的点击效果