제목에서 알 수 있듯이 Dagger2는 Dagger * 접두어를 생성하지 않습니다. 나는 다른 유사한 포스트를 여기에서 보았다. 그러나 아무것도 작동하는 것처럼 보이지 않는다. Dagger2 단검을 생성하지 않음 * 클래스
나는이 REPO https://github.com/ecgreb/mvpc를 복제 안드로이드 스튜디오의 캐시를 무효화를 다시 시작, 내가 청소$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'
}
Application 클래스.
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
이 repo에는 '단검'코드가 없습니다. 그것의 유일한 mvp – AJay