Android:编译错误:任务’:app:compileDebugJava’的执行失败
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Android:编译错误:任务’:app:compileDebugJava’的执行失败,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2265字,纯文字阅读大概需要4分钟。
内容图文
![Android:编译错误:任务’:app:compileDebugJava’的执行失败](/upload/InfoBanner/zyjiaocheng/746/f960c5ae74ec48d49ab1b304c4743947.jpg)
我面临以下错误:
Error:(89, 39) error: incomparable types: CAP#1 and int
where CAP#1 is a fresh type-variable:
CAP#1 extends Object from capture of ?Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Error:Execution failed for task ':app:compileDebugJava'.
Compilation failed; see the compiler error output for details.
我的Gradle文件如下所示:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0 rc3"
repositories {
maven { url "https://jitpack.io" }
mavenCentral()
jcenter()
}
defaultConfig {
applicationId "wishlist.oj.app"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:recyclerview-v7:21.+'
compile 'com.android.support:cardview-v7:21.+'
}
错误来自My Recycler View Adapter File,它只是将多页面文本视图扩展到Recycler视图
解决方法:
Error:Execution failed for task ‘:app:compileDebugJava’.
为了良好实践
首先启用multiDexEnabled,然后升级您的支持:recyclerview,support:appcompat,support:cardview version
The Android plugin for Gradle available in Android SDK Build Tools
21.1 and higher supports multidex as part of your build configuration. Make sure you update the Android SDK Build Tools tools and the Android
Support Repository to the latest version using the SDK Manager before
attempting to configure your app for multidex.
设置应用程序开发项目以使用multidex配置需要您对应用程序开发项目进行一些修改.特别是您需要执行以下步骤:
>更改Gradle构建配置以启用multidex
>修改清单以引用MultiDexApplication类
修改您的应用程序Gradle构建文件配置以包括支持库并启用multidex输出.
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
...
minSdkVersion 16
targetSdkVersion 23
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1"
compile 'com.android.support:cardview-v7:23.1.1'
}
然后清理 – 重建 – 重新启动 – 同步您的项目
内容总结
以上是互联网集市为您收集整理的Android:编译错误:任务’:app:compileDebugJava’的执行失败全部内容,希望文章能够帮你解决Android:编译错误:任务’:app:compileDebugJava’的执行失败所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。