- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试获取 retrolambda使用 gradle 构建的 Android。 java 8 的改变导致了一些 android 注释的问题。
我已经尝试了这些帖子中的几乎所有内容:(在阅读所有这些链接之前先更新 3)
http://code.google.com/p/android/issues/detail?id=55764
https://bitbucket.org/hvisser/android-apt
AndroidAnnotations Nothing Generated, Empty Activity
Android studio + Gradle + Android Annotations
How to compile AndroidAnnotations with Google Android Gradle Plugin?
但我不断收到这些错误:
Gradle: error: package android.annotation does not exist
Gradle: error: cannot find symbol class TargetApi
还有那些 gradle 警告:
Gradle: : Supported source version 'RELEASE_6' from annotation processor 'com.googlecode.androidannotations.AndroidAnnotationProcessor' less than -source '1.8'
Gradle: : The following options were not recognized by any processor: '[androidManifestFile]'
这是我的 build.gradle 文件,使用 https://stackoverflow.com/a/16802216/860488 (链接 3 最受好评的解决方案):
buildscript {
repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
classpath 'com.google.guava:guava:14.0.1'
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
classpath 'me.tatarka:gradle-retrolambda:1.1.1'
}
}
repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
}
apply plugin: 'android'
apply plugin: 'crashlytics'
apply plugin: 'retrolambda'
ext.daggerVersion = '1.0.0'
ext.androidAnnotationsVersion = '2.7.1'
configurations {
apt
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.google.guava:guava:14.0.1'
compile 'com.crashlytics.android:crashlytics:1.+'
apt "com.googlecode.androidannotations:androidannotations:${androidAnnotationsVersion}"
compile "com.googlecode.androidannotations:androidannotations-api:${androidAnnotationsVersion}"
apt "com.squareup.dagger:dagger-compiler:${daggerVersion}"
compile "com.squareup.dagger:dagger:${daggerVersion}"
}
android {
packagingOptions { //Fix: https://stackoverflow.com/a/20675331/860488
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion 10
buildToolsVersion "18.0.1"
defaultConfig {
minSdkVersion 7
targetSdkVersion 10
buildConfigField "boolean", "useProductionServices", "true"
}
buildTypes {
testflight.initWith(buildTypes.debug)
debug {
packageNameSuffix ".debug"
buildConfigField "boolean", "useProductionServices", "false"
}
testflight {
packageNameSuffix ".testflight"
buildConfigField "boolean", "useProductionServices", "true"
}
release {
buildConfigField "boolean", "useProductionServices", "true"
}
}
}
retrolambda {
compile "net.orfjackal.retrolambda:retrolambda:1.1.2"
jdk System.getenv("JAVA8_HOME")
}
android.applicationVariants.all { variant ->
aptOutput = file("${project.buildDir}/source/apt_generated/${variant.dirName}")
println "****************************"
println "variant: ${variant.name}"
println "manifest: ${variant.processResources.manifestFile}"
println "aptOutput: ${aptOutput}"
println "****************************"
variant.javaCompile.doFirst {
println "*** compile doFirst ${variant.name}"
aptOutput.mkdirs()
variant.javaCompile.options.compilerArgs += [
'-processorpath', configurations.apt.getAsPath(),
'-AandroidManifestFile=' + variant.processResources.manifestFile,
'-s', aptOutput
]
}
}
我正在使用 Intellij EDEA 13.0.2。
我没有在 android.applicationVariants.all 中看到任何包含 println 语句内容的输出 - 我应该在哪里看到它们?
关于如何解决这个问题的任何线索?
更新 1:
我已经尝试使用 Groovy 调试 build.gradle,并且每件事都打印得很好。每个构建类型的 build\source\apt_generated\debug 的正确路径。
但是我收到了一些警告:
Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties. Deprecated dynamic property: "aptOutput" on "com.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated@4445b7e3", value: "C:\projectpath...".
****************************
variant: debug
manifest: C:\projectpath\build\manifests\debug\AndroidManifest.xml
aptOutput: C:\projectpath\build\source\apt_generated\debug
****************************
Deprecated dynamic property "aptOutput" created in multiple locations.
****************************
variant: release
manifest: C:\projectpath\build\manifests\release\AndroidManifest.xml
aptOutput: C:\projectpath\build\source\apt_generated\release
****************************
****************************
variant: testflight
manifest: C:\projectpath\build\manifests\testflight\AndroidManifest.xml
aptOutput: C:\projectpath\build\source\apt_generated\testflight
****************************
并且apt_generated\debug文件夹下没有内容。有什么线索吗?
更新 2:
我试过 Dodges answer除了警告之外,它产生了相同的输出,但文件夹 apt_generated\debug 中仍然没有内容。
更新 3:
我发现这个问题与链接的帖子不同。这是它找不到的 android.annotations - 不是 androidannotations .但仍然没有解决方案..
最佳答案
我已经通过直接包含android-sdk/tools/support/annotations.jar 中的annotations.jar 文件解决了这个问题。但这是一种 hack。
我仍在寻找真正的解决方案。
关于android - Gradle with java 8 for retrolambda - Android 找不到注释 TargetApi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21479566/
例如,我有一个父类Author: class Author { String name static hasMany = [ fiction: Book,
代码如下: dojo.query(subNav.navClass).forEach(function(node, index, arr){ if(dojo.style(node, 'd
我有一个带有 Id 和姓名的学生表和一个带有 Id 和 friend Id 的 Friends 表。我想加入这两个表并找到学生的 friend 。 例如,Ashley 的 friend 是 Saman
我通过互联网浏览,但仍未找到问题的答案。应该很容易: class Parent { String name Child child } 当我有一个 child 对象时,如何获得它的 paren
我正在尝试创建一个以 Firebase 作为我的后端的社交应用。现在我正面临如何(在哪里?)找到 friend 功能的问题。 我有每个用户的邮件地址。 我可以访问用户的电话也预订。 在传统的后端中,我
我主要想澄清以下几点: 1。有人告诉我,在 iOS 5 及以下版本中,如果您使用 Game Center 设置多人游戏,则“查找 Facebook 好友”(如与好友争夺战)的功能不是内置的,因此您需要
关于redis docker镜像ENTRYPOINT脚本 docker-entrypoint.sh : #!/bin/sh set -e # first arg is `-f` or `--some-
我是一名优秀的程序员,十分优秀!