0

I asked this question previously https://stackoverflow.com/questions/35981039/instrumentation-doesnt-inject-touch-in-rooted-device which states that instrumentation doesn't work on Lollipop and later versions. After some deep search I found that we should add Dagger-2 to be compiled with the project. I used the steps related to gradle available here: https://github.com/codepath/android_guides/wiki/Dependency-Injection-with-Dagger-2

This is my build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.0'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

This is app/build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'

android {
    compileSdkVersion 19
    buildToolsVersion "19.1.0"

    defaultConfig {
        applicationId "com.project.android.vecsat"
        minSdkVersion 10
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:19.0.0'
    compile 'com.android.support:support-v4:19.0.0'
    apt 'com.google.dagger:dagger-compiler:2.0.2'
    compile 'com.google.dagger:dagger:2.0.2'
    provided 'org.glassfish:javax.annotation:10.0-b28'
    compile project(':libraries:opencv')

}

After synchronizing the project, nothing was fixed. Still instrumentation doesn't work. I found another guide here: https://github.com/kkovach/dagger/blob/update-install-gradle/README.md

But, I don't know where to place dagger jar file, and I can't figure out where is java gradle.

Can somebody please help me? What are the correct steps to add Dagger-2 to the project?

Community
  • 1
  • 1
Dania
  • 1,648
  • 4
  • 31
  • 57
  • Check out [this](http://code.tutsplus.com/tutorials/dependency-injection-with-dagger-2-on-android--cms-23345) tutorial. It will guide you – NightFury Mar 15 '16 at 10:08
  • @iAnum, thanks. I see that it uses two classes, I don't have to create classes, I just need to call instrumentation to simulate a touch event, how can I add dagger in this case? – Dania Mar 15 '16 at 10:26

0 Answers0