現在、AndroidAnnotationsで開発された一部のFragmentsを使用するAndroidライブラリで作業しています。 Androidアプリケーションとしてコンパイルされると、コードは問題なくすべてが機能します。 Androidライブラリとしてコンパイルされると、AndroidAnnotations生成クラスが見つからないため、ブレークします。AndroidAnnotationsとFragmentsでライブラリプロジェクトをコンパイル
@EActivity(R.layout.activity_name)
ではなく、それぞれのアクティビティに@EActivity(resName="activity_name")
と注釈を付けました。これにより、いくつかのエラーが修正されます。
私が遭遇した問題は、これらの活動の一部では、私は(例えば)このようないくつかの断片を動的に作成することです:
PhotoFragment fragment = PhotoFragment_.builder().someParams("a string param").build();
私はAndroidのライブラリとしてコンパイルしようとすると、この呼び出しが失敗した理由動的に生成されたPhotoFragment_
クラスを見つけることができません。それを動作させるソリューションはありますか?いずれかの私は、フラグメントを作成する方法を変更するか、AndroidAnnotationsを設定することによってですか?
EDIT 20/04/2016
マイbuild.gradle
(モジュールレベル):
apply plugin: 'com.android.library'
apply plugin: 'android-apt'
def AAVersion = '4.0.0'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
// Barcode library (ZXing)
compile 'com.journeyapps:zxing-android-embedded:3.0.2'
compile 'com.google.zxing:core:3.2.0'
// Android Annotations
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
// Android Bootstrap
compile 'com.beardedhen:androidbootstrap:2.1.0'
// Gson
compile 'com.google.code.gson:gson:2.4'
// Some auto-generated BS
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
// Robotium --> Emulate User Interaction on tests
compile 'com.jayway.android.robotium:robotium-solo:5.5.4'
// Android Testing
androidTestCompile 'com.android.support:support-annotations:23.2.1'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
// OkHTTP (HTTP Client Library)
compile 'com.squareup.okhttp3:okhttp:3.2.0'
}
apt {
arguments {
library 'true'
}
}
どうもありがとう!
生成されたクラスはライブラリ内には表示されません。また、ライブラリ以外の生成クラス(ライブラリを使用するアプリケーションなど)は表示されません。 – WonderCsabo
@WonderCsabo生成されたクラスがライブラリ内に表示されません。この時点で私はAARとしてライブラリをコンパイルしようとしていますが、私はできません:) –
あなたのAAバージョンは何ですか? – WonderCsabo