Android Studio 项目已停止构建。检索项目的父项时出错:android:TextAppearance.Material.Widget.Button.Inverse
Android Studio project has stopped building. Error retrieving parent for item: android:TextAppearance.Material.Widget.Button.Inverse
过去 2 年我一直在做一个项目,从大约去年 1 年开始我将它转移到 Android Studio(我目前使用 Android Studio 1.5.1) .就在今天,当我将项目打开到 运行 时,我得到了 Error retrieving parent for item: android:TextAppearance.Material.Widget.Button.Inverse and android:Widget.MaterialButton.Colored 错误。
以下是我的 app.gradle 文件:
import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.opaxlabs.boatbrat"
minSdkVersion 14
targetSdkVersion 22
versionCode 20
versionName '2.0'
multiDexEnabled true
// ndk {
// moduleName "password"
// abiFilter "all"
// }
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
dexOptions{
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// sourceSets.main.jni.srcDirs = [] // disable automatic ndk-build call, which ignore our Android.mk
// sourceSets.main.jniLibs.srcDir 'src/main/libs'
//
// // call regular ndk-build(.cmd) script from app directory
// task ndkBuild(type: Exec) {
// workingDir file('src/main')
// commandLine getNdkBuildCmd()
// }
//
// tasks.withType(JavaCompile) {
// compileTask -> compileTask.dependsOn ndkBuild
// }
//
// task cleanNative(type: Exec) {
// workingDir file('src/main')
// commandLine getNdkBuildCmd(), 'clean'
// }
//
// clean.dependsOn cleanNative
// splits {
// abi {
// enable true
// reset()
// include 'x86', 'armeabi-v7a', 'mips'
// universalApk true
// }
// }
}
//repositories {
// jcenter()
// maven { url "http://dl.bintray.com/webactive/maven" }
//}
//def getNdkDir() {
// if (System.env.ANDROID_NDK_ROOT != null)
// return System.env.ANDROID_NDK_ROOT
//
// Properties properties = new Properties()
// properties.load(project.rootProject.file('local.properties').newDataInputStream())
// def ndkdir = properties.getProperty('ndk.dir', null)
// if (ndkdir == null)
// throw new GradleException("NDK location not found. Define location with ndk.dir in the local.properties file or with an ANDROID_NDK_ROOT environment variable.")
//
// return ndkdir
//}
//
//def getNdkBuildCmd() {
// def ndkbuild = getNdkDir() + "/ndk-build"
// if (Os.isFamily(Os.FAMILY_WINDOWS))
// ndkbuild += ".cmd"
//
// return ndkbuild
//}
repositories {
jcenter()
maven { url "http://dl.bintray.com/webactive/maven" }
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
// compile 'com.android.support:support-v4:+'
compile 'com.google.android.gms:play-services:+'
// {
// exclude module: 'play-services-analytics'
// }
// compile ('com.google.android.gms:play-services-analytics:7.3.0')
compile 'com.android.support:appcompat-v7:22.+'
// compile 'com.stripe:stripe-android:+'
// compile files('libs/PayPal_MPL.jar')
compile files('libs/cwac-adapter-1.0.2.jar')
compile files('libs/devsmartlib.jar')
compile files('libs/fluent-hc-4.3.3.jar')
compile files('libs/httpasyncclient-4.0.1.jar')
compile files('libs/httpasyncclient-cache-4.0.1.jar')
compile files('libs/httpclient-4.3.2.jar')
compile files('libs/httpclient-cache-4.3.1.jar')
compile files('libs/httpcore-4.3.2.jar')
compile files('libs/httpmime-4.3.3.jar')
compile files('libs/universal-image-loader-1.9.2-with-sources.jar')
compile files('libs/endless-1.2.3.jar')
compile files('libs/jncryptor-1.2.0.jar')
compile files('libs/commons-codec-1.7-SNAPSHOT-android.jar')
compile 'com.eway.payment:android-sdk:1.1'
}
我正在使用较低版本的构建工具,因为该项目有很多代码已弃用,使用更高版本的工具和 sdk 可能会使问题复杂化。我什至尝试使用版本 23 进行构建,但这没有帮助。
我尝试了以下内容:
This
和
this
但他们基本上是在说我已经做过的事情。
任何帮助将不胜感激。提前致谢。
因为您正在使用
compile 'com.google.android.gms:play-services:+'
您正在使用最新版本 compile 'com.google.android.gms:play-services:8.4.0'
,它依赖于支持库 v23。
您必须使用 API 23.
进行编译
更改此行:
compileSdkVersion 23
一般来说,在你的依赖中使用 +
不是一个好习惯,因为你不能在未来使用相同的库复制构建,你不知道你用的是哪个版本。
过去 2 年我一直在做一个项目,从大约去年 1 年开始我将它转移到 Android Studio(我目前使用 Android Studio 1.5.1) .就在今天,当我将项目打开到 运行 时,我得到了 Error retrieving parent for item: android:TextAppearance.Material.Widget.Button.Inverse and android:Widget.MaterialButton.Colored 错误。 以下是我的 app.gradle 文件:
import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.opaxlabs.boatbrat"
minSdkVersion 14
targetSdkVersion 22
versionCode 20
versionName '2.0'
multiDexEnabled true
// ndk {
// moduleName "password"
// abiFilter "all"
// }
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
dexOptions{
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// sourceSets.main.jni.srcDirs = [] // disable automatic ndk-build call, which ignore our Android.mk
// sourceSets.main.jniLibs.srcDir 'src/main/libs'
//
// // call regular ndk-build(.cmd) script from app directory
// task ndkBuild(type: Exec) {
// workingDir file('src/main')
// commandLine getNdkBuildCmd()
// }
//
// tasks.withType(JavaCompile) {
// compileTask -> compileTask.dependsOn ndkBuild
// }
//
// task cleanNative(type: Exec) {
// workingDir file('src/main')
// commandLine getNdkBuildCmd(), 'clean'
// }
//
// clean.dependsOn cleanNative
// splits {
// abi {
// enable true
// reset()
// include 'x86', 'armeabi-v7a', 'mips'
// universalApk true
// }
// }
}
//repositories {
// jcenter()
// maven { url "http://dl.bintray.com/webactive/maven" }
//}
//def getNdkDir() {
// if (System.env.ANDROID_NDK_ROOT != null)
// return System.env.ANDROID_NDK_ROOT
//
// Properties properties = new Properties()
// properties.load(project.rootProject.file('local.properties').newDataInputStream())
// def ndkdir = properties.getProperty('ndk.dir', null)
// if (ndkdir == null)
// throw new GradleException("NDK location not found. Define location with ndk.dir in the local.properties file or with an ANDROID_NDK_ROOT environment variable.")
//
// return ndkdir
//}
//
//def getNdkBuildCmd() {
// def ndkbuild = getNdkDir() + "/ndk-build"
// if (Os.isFamily(Os.FAMILY_WINDOWS))
// ndkbuild += ".cmd"
//
// return ndkbuild
//}
repositories {
jcenter()
maven { url "http://dl.bintray.com/webactive/maven" }
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
// compile 'com.android.support:support-v4:+'
compile 'com.google.android.gms:play-services:+'
// {
// exclude module: 'play-services-analytics'
// }
// compile ('com.google.android.gms:play-services-analytics:7.3.0')
compile 'com.android.support:appcompat-v7:22.+'
// compile 'com.stripe:stripe-android:+'
// compile files('libs/PayPal_MPL.jar')
compile files('libs/cwac-adapter-1.0.2.jar')
compile files('libs/devsmartlib.jar')
compile files('libs/fluent-hc-4.3.3.jar')
compile files('libs/httpasyncclient-4.0.1.jar')
compile files('libs/httpasyncclient-cache-4.0.1.jar')
compile files('libs/httpclient-4.3.2.jar')
compile files('libs/httpclient-cache-4.3.1.jar')
compile files('libs/httpcore-4.3.2.jar')
compile files('libs/httpmime-4.3.3.jar')
compile files('libs/universal-image-loader-1.9.2-with-sources.jar')
compile files('libs/endless-1.2.3.jar')
compile files('libs/jncryptor-1.2.0.jar')
compile files('libs/commons-codec-1.7-SNAPSHOT-android.jar')
compile 'com.eway.payment:android-sdk:1.1'
}
我正在使用较低版本的构建工具,因为该项目有很多代码已弃用,使用更高版本的工具和 sdk 可能会使问题复杂化。我什至尝试使用版本 23 进行构建,但这没有帮助。 我尝试了以下内容: This 和 this 但他们基本上是在说我已经做过的事情。 任何帮助将不胜感激。提前致谢。
因为您正在使用
compile 'com.google.android.gms:play-services:+'
您正在使用最新版本 compile 'com.google.android.gms:play-services:8.4.0'
,它依赖于支持库 v23。
您必须使用 API 23.
进行编译更改此行:
compileSdkVersion 23
一般来说,在你的依赖中使用 +
不是一个好习惯,因为你不能在未来使用相同的库复制构建,你不知道你用的是哪个版本。