【发布时间】:2016-07-15 19:38:39
【问题描述】:
我正在尝试为 Android 6 构建消息传递应用程序...... 我已经将包/应用程序/消息导入 Android Studio ... 并创建了以下 build.gradle 文件:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.+'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
defaultConfig {
applicationId "com.android.messaging"
minSdkVersion 23
targetSdkVersion 23
ndk {
moduleName "libgiftranscode"
}
repositories {
mavenCentral()
}
testApplicationId "com.android.messaging.test"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
dependencies {
compile "com.android.support:support-v4:+"
compile "com.android.support:appcompat-v7:+"
compile "com.android.support:recyclerview-v7:+"
compile "com.android.support:palette-v7:+"
compile "com.android.support:support-v13:+"
compile group: 'com.google.guava', name: 'guava', version: '18.0'
compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.0'
compile group: 'com.googlecode.libphonenumber', name: 'libphonenumber', version: '3.5'
compile group: 'com.klinkerapps', name: 'android-chips', version: '1.0.2'
// https://mvnrepository.com/artifact/com.google.collections/google-collections
compile group: 'com.google.collections', name: 'google-collections', version: '1.0'
// https://mvnrepository.com/artifact/com.1gravity/android-colorpicker
compile group: 'com.1gravity', name: 'android-colorpicker', version: '2.0.1'
// https://mvnrepository.com/artifact/com.googlecode.ez-vcard/ez-vcard
compile group: 'com.googlecode.ez-vcard', name: 'ez-vcard', version: '0.4.1'
// https://mvnrepository.com/artifact/javax.annotation/jsr250-api
compile group: 'javax.annotation', name: 'jsr250-api', version: '1.0'
// https://mvnrepository.com/artifact/com.google.guava/guava-annotations
compile group: 'com.google.guava', name: 'guava-annotations', version: 'r03'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
它的构建基本没问题,但最后我得到了:
启动进程'命令 '/home/vadim/Android/Sdk/build-tools/23.0.2/aapt''。工作目录: /home/vadim/work/Messaging2 命令: /home/vadim/Android/Sdk/build-tools/23.0.2/aapt package -f --no-crunch -I /home/vadim/Android/Sdk/platforms/android-23/android.jar -M /home/vadim/work/Messaging2/build/intermediates/manifests/full/debug/AndroidManifest.xml -S /home/vadim/work/Messaging2/build/intermediates/res/merged/debug -A /home/vadim/work/Messaging2/build/intermediates/assets/debug -m -J /home/vadim/work/Messaging2/build/generated/source/r/debug -F /home/vadim/work/Messaging2/build/intermediates/res/resources-debug.ap_ --debug-mode --custom-package com.android.messaging -0 apk --output-text-symbols /home/vadim/work/Messaging2/build/intermediates/symbols/debug 成功启动进程'命令 '/home/vadim/Android/Sdk/build-tools/23.0.2/aapt'' /home/vadim/work/Messaging2/res/values/styles.xml:2:检索错误 项目的父项:未找到与给定名称匹配的资源 'PhotoViewTheme.Translucent'。
:processDebugResources 失败:processDebugResources (Thread[main,5,main]) 完成。耗时 1.175 秒。
FAILURE:构建失败并出现异常。
出了什么问题:任务 ':processDebugResources' 执行失败。
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/vadim/Android/Sdk/build-tools/23.0.2/aapt'' 完成 非零退出值 1
尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --debug 选项运行以获得更多日志输出。
缺少的样式“PhotoViewTheme.Translucent”似乎位于 appcompat 库中,但我的构建没有找到它... 关于如何解决它的任何想法?
谢谢
【问题讨论】:
-
你的 SDK 是最新的吗?
-
是的...这是我检查的第一件事
标签: android gradle android-source