2016-03-22 5 views
1

Ich versuche, JUnit in meiner Android-App zu verwenden. Ich habe diese build.gradle/app-Konfiguration:Ich versuche, Junit mit Apt-Plugin zu verwenden

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

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.2" 

    defaultConfig { 
     applicationId "com.myproject.tv" 
     minSdkVersion 21 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 


repositories { jcenter() } 

apt { 
    arguments { 
     androidManifestFile variant.outputs[0].processResources.manifestFile 
     resourcePackageName android.defaultConfig.applicationId 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' //added 
    compile 'com.squareup.retrofit:retrofit:1.9.0' 
    compile 'com.android.support:recyclerview-v7:23.2.0' 
    compile 'com.android.support:leanback-v17:23.2.0' 
    compile 'com.android.support:appcompat-v7:23.2.0' 
    compile 'com.github.bumptech.glide:glide:3.4.+' 
    compile 'com.squareup.okhttp:okhttp:2.5.0' 
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.5.0' 
    compile 'com.android.support:support-v4:23.2.0' 
    compile 'com.android.support:design:23.2.0' 
    compile 'com.danikula:videocache:2.3.3' 
    compile 'org.androidannotations:androidannotations-api:3.3.2' 
    apt 'org.androidannotations:androidannotations:3.3.2' 
    compile 'com.google.dagger:dagger:2.0.2' 
    apt 'com.google.dagger:dagger-compiler:2.0.2' 
    provided 'org.glassfish:javax.annotation:10.0-b28' 
} 

Wenn ich die Anwendung ausführen:

Error:(28, 0) Cannot get property 'processResources' on null object 
<a href="openFile:E:\AndroidProject\JoinTV\app\build.gradle">Open File</a> 

Die Linie 28 ist:

26 apt { 
27 arguments { 
28  androidManifestFile variant.outputs[0].processResources.manifestFile 
29  resourcePackageName android.defaultConfig.applicationId 
30 } 
31} 

Wie behebe ich dieses Problem in meinem Gradel ???

Antwort

-2

ich das gleiche Problem

traf

löschen testCompile 'junit:junit:4.12' // hinzugefügt

synchronisieren dann werden Sie

+0

Dies ist nicht die Antwort beheben. Das OP möchte "Junit" in Ihrem Projekt verwenden. –

2
Try this. It worked for me. 
<pre><code> 
    apt { 
     arguments { 
      androidManifestFile variant.outputs[0]?.processResources?.manifestFile 
      resourcePackageName android.defaultConfig.applicationId 
     } 
    } 
</code></pre> 
+0

Ja, es funktioniert mit 'testCompile 'junit: junit: 4.12'' und es löst das Problem des op –

Verwandte Themen