gpt4 book ai didi

Android 注释未使用 buildToolsVersion 19.1.0 生成

转载 作者:行者123 更新时间:2023-11-30 02:49:06 25 4
gpt4 key购买 nike

随着 Android Studio 的最新更新,我被迫进入 gradle 0.11 ('com.android.tools.build:gradle:0.11.+'),同时我还将 buildToolsVersion 更改为“19.1.0”。

还有新的 gradle 和构建工具,我以前的 Android 注释不起作用,所以我去了官方 AA 网站,我把这个放到我的 gradle 文件中:

apply plugin: 'android'
apply plugin: 'android-apt'

apt {
arguments {
androidManifestFile variant.processResources.manifestFile
resourcePackageName android.defaultConfig.packageName
}
}

很遗憾,它不会生成任何 AA 类。

我认为我的问题可能是我使用了两种口味:付费和免费。

这是我的完整 gradle 文件:

buildscript {
repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
// replace with the current version of the Android plugin
classpath 'com.android.tools.build:gradle:0.11.+'

// the latest version of the android-apt plugin
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.+'

// Crashlitics
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}

repositories {
mavenCentral()
mavenLocal()
maven { url 'http://download.crashlytics.com/maven' }
}

apply plugin: 'android'
apply plugin: 'crashlytics'
apply plugin: 'android-apt'

apt {
arguments {
androidManifestFile variant.processResources.manifestFile
// resourcePackageName android.defaultConfig.applicationId
resourcePackageName android.defaultConfig.packageName
}
}

def AAVersion = '3.0.1'
def ORMLiteVersion = '4.46'
def mainPackage = 'com.xxx'
def paidPackage = mainPackage + '.paid'
def freePackage = mainPackage + '.free'

dependencies {
[...]

// Android annotations
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"

[...]
}

android {
compileSdkVersion 19
buildToolsVersion "19.1.0"

defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionCode 4
versionName "1.4.0-scroll-fast"
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}

signingConfigs {
release {
storeFile file("../../transport.keystore.jks")
storePassword releaseStorePassword
keyAlias releaseKeyAlias
keyPassword releaseKeyPassword
}


debug {
storeFile file("../../debug.keystore")
}
}

buildTypes {
release {
runProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'

buildConfigField "java.lang.String", "DATABASE_NAME", "\"transporter\""
buildConfigField "int", "DATABASE_VERSION", "1"

buildConfigField "java.lang.String", "PAID_PACKAGE_NAME", "\"$paidPackage\""
buildConfigField "java.lang.String", "FREE_PACKAGE_NAME", "\"$freePackage\""

signingConfig signingConfigs.release
}

debug.initWith(buildTypes.release)
debug {
debuggable true
runProguard false
signingConfig signingConfigs.debug
}
}

productFlavors {
free {
applicationId freePackage
[...]
}

paid {
applicationId paidPackage
[...]
}
}
}

@编辑

感谢 Alex(添加了 android { useOldManifestMerger true })AA 开始处理但仍然无法正常工作:

22:39:08.449 [Daemon Thread 15] INFO  o.a.AndroidAnnotationProcessor:85 - Initialize AndroidAnnotations 3.0.1 with options {androidManifestFile=D:\Programowanie\GitProjects\transport\android-Transport\transport\build\intermediates\manifests\paid\release\AndroidManifest.xml, resourcePackageName=null}
22:39:08.495 [Daemon Thread 15] INFO o.a.AndroidAnnotationProcessor:109 - Start processing for 14 annotations on 46 elements
22:39:08.506 [Daemon Thread 15] DEBUG o.a.h.AndroidManifestFinder:98 - AndroidManifest.xml file found with specified path: D:\Programowanie\GitProjects\transport\android-Transport\transport\build\intermediates\manifests\paid\release\AndroidManifest.xml
22:39:08.510 [Daemon Thread 15] INFO o.a.AndroidAnnotationProcessor:172 - AndroidManifest.xml found: AndroidManifest [applicationPackage=pl.grzeslowski.transport.paid, componentQualifiedNames=[pl.grzeslowski.transport.activities.MainActivity_, pl.grzeslowski.transport.activities.ResultActivity_, pl.grzeslowski.transport.activities.InfoActivity_, pl.grzeslowski.transport.activities.InfoActivity], permissionQualifiedNames=[android.permission.INTERNET, android.permission.ACCESS_NETWORK_STATE], applicationClassName=pl.grzeslowski.transport.TransporterApplication_, libraryProject=false, debugabble=false, minSdkVersion=9, maxSdkVersion=-1, targetSdkVersion=19]
22:39:08.512 [Daemon Thread 15] ERROR o.a.r.ProjectRClassFinder:46 - The generated null.R class cannot be found
22:39:08.513 [Daemon Thread 15] INFO o.a.r.AndroidRClassFinder:44 - Found Android class: android.R
22:39:08.521 [Daemon Thread 15] INFO o.a.p.TimeStats:81 - Time measurements: [Whole Processing = 26 ms], [Extract Annotations = 9 ms], [Extract Manifest = 5 ms],
22:39:08.522 [Daemon Thread 15] INFO o.a.AndroidAnnotationProcessor:123 - Finish processing

最佳答案

这可能是 0.11 的一个已知问题

http://code.google.com/p/android/issues/detail?id=72450

关于Android 注释未使用 buildToolsVersion 19.1.0 生成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24518767/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com