我在尝试为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消息2/构建/中间层/资产/调试/home/vadim/work/Messaging2/build/generated/source/r/debug /home/vadim/work/Messaging2/build/intermediates/res/resources-debug.ap_ --调试-模式-自定义包com.android.messaging -0 apk -输出-文本-符号/home/vadim/work/Messaging2/build/intermediates/symbols/debug成功启动进程‘命令’/vadim/Android/Sdk/build/23.0.2/aapt'‘/home/vadim/work/Messaging2/res/values/styles.xml:2 :错误检索项的父级:没有找到与给定名称“PhotoViewTheme.TransLucent”匹配的资源。 processDebugResources失败:processDebugResources (Threadmain,5,main)完成。花了1.175秒。 失败:生成失败,出现异常。
缺少的样式'PhotoViewTheme.Translucent‘似乎驻留在appcompat库中,但我的构建没有找到它.有什么解决办法吗?
谢谢
发布于 2016-07-19 07:37:21
我很抱歉让您失望,但是您的不能从源导入特定的文件,并将其作为常规的apk构建在您的Gradle中。
系统应用程序是在linux环境中使用GNU构建的,而不是普通apks Gradle。
要编译一个系统应用程序,首先需要构建整个AOSP。(如果这是你的第一次,大约需要一个星期)
我会在网上搜索这个应用程序(或类似的应用程序)的分级版本。
发布于 2017-07-31 18:26:21
您的输出声明错误:
/home/vadim/work/Messaging2/res/values/styles.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'PhotoViewTheme.Translucent'这仅仅意味着应用程序缺少了另一个应用程序的父级样式。
查看消息应用程序源代码中的Android.mk文件。它清楚地提到
LOCAL_RESOURCE_DIR += frameworks/opt/photoviewer/res这意味着你也需要这些资源。只要谷歌的PhotoViewTheme.Translucent和添加风格/主题的应用程序。Nir在某种程度上是正确的,但如果你有能力使其符合等级标准,就可以在android中构建源代码应用。这里是来自AOSP的代码,您可能想看看它。将其添加到styles.xml或其他文件中。干杯!
https://stackoverflow.com/questions/38403927
复制相似问题