Dagger2はDagger *プレフィックスクラスを生成していません。私はここにいくつかの他の同様の記事を見たが、何も動作していないようです。 Dagger2 Dagger *クラスを生成しない
私は、このレポ https://github.com/ecgreb/mvpcをクローン化されたAndroidのメーカーのキャッシュを無効にされ、それを再起動し、私はクリーン$Project/.gradle
と
$Home/.gradle/caches
、削除し、プロジェクトを再構築し、まだ動作しません。
はこれもDagger2
を使用しているいくつかのプロジェクトに起こった私は何かが足りないのですか?
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.example.ecgreb.mvpc"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
tasks.withType(Test) {
testLogging {
exceptionFormat "full"
events "started", "skipped", "passed", "failed"
showStandardStreams true
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile "com.google.dagger:dagger:2.7"
annotationProcessor "com.google.dagger:dagger-compiler:2.7"
provided 'javax.annotation:jsr250-api:1.0'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'org.assertj:assertj-core:1.7.1'
testCompile 'org.robolectric:robolectric:3.1.2'
testCompile 'org.khronos:opengl-api:gl1.1-android-2.1_r1'
}
アプリケーションクラス。
package com.example.ecgreb.mvpc;
import android.app.Application;
import com.example.ecgreb.mvpc.controller.LoginActivity;
import javax.inject.Singleton;
import dagger.Component;
public class MvpcApplication extends Application {
@Singleton @Component(modules = { LoginModule.class }) public interface ApplicationComponent {
void inject(LoginActivity loginActivity);
}
private ApplicationComponent component;
@Override public void onCreate() {
super.onCreate();
//DaggerApplicationComponent IS NOT BEING GENERATED
component = DaggerApplicationComponent.builder().build();
}
public ApplicationComponent component() {
return component;
}
}
ApplicationComponentクラスを共有してください。 – AJay
https://github.com/antoniolg/androidmvpここでコード全体を確認できます。 @AJay – Bri6ko
このレポには「ダガー」コードはありません。その唯一のMVP – AJay