freepascal / android-test-kit

Automatically exported from code.google.com/p/android-test-kit
0 stars 0 forks source link

Adding "androidTestCompile 'com.android.support.test.espresso:espresso-core:2.0'" to dependencies causes build to fail #122

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a new android app
2. add "androidTestCompile 
'com.android.support.test.espresso:espresso-core:2.0'" to the dependencies
3. ./gradlew connectedCheck

What version of the product are you using? On what operating system?
Espresso 2.0, gradle 2.2.1, buildtools 21.1.2

Expected: BUILD SUCCESSFUL

Actual Results: FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':testapp:packageDebugTest'.
> Duplicate files copied in APK LICENSE.txt
    File 1: /Users/mike/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.1/860340562250678d1a344907ac75754e259cdb14/hamcrest-core-1.1.jar
    File 2: /Users/mike/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.1/860340562250678d1a344907ac75754e259cdb14/hamcrest-core-1.1.jar

I'm trying to write up the instructions for using espresso for the next version 
of Android App Development for Dummies, but I'm hitting this blocker out of the 
gate.  There are possible workarounds, but it should work out of the box.

Original issue reported on code.google.com by m...@niskala.org on 17 Jan 2015 at 9:53

GoogleCodeExporter commented 9 years ago
Yep, the setup instructions as is are wrong. Getting the same error.

Original comment by engappsm...@gmail.com on 25 Jan 2015 at 8:07

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
The issue here is that the jar is getting written twice in one of these files:

        'META-INF/DEPENDENCIES.txt'
        'META-INF/LICENSE.txt'
        'META-INF/NOTICE.txt'
        'META-INF/NOTICE'
        'META-INF/LICENSE'
        'META-INF/DEPENDENCIES'
        'META-INF/notice.txt'
        'META-INF/license.txt'
        'META-INF/dependencies.txt'
        'META-INF/LGPL2.1'
        'LICENSE.txt'
In order to avoid this add the following code you your app module's 
build.gradle inside the android{}:

  packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
        exclude 'LICENSE.txt'
    }
Also, the guide is missing a call to matches() here:

onView(withText("Hello world!")).check(matches(isDisplayed()));.

 If you are running these tests right out of the new project template from Android Studio please note that the default string text for the TextView is "Hello world!" (note the "!"), and the sample test is looking for a View with "Hello world" (no "!")

Original comment by emmanuel...@gmail.com on 9 Mar 2015 at 6:06

GoogleCodeExporter commented 9 years ago

Original comment by vale...@google.com on 16 Mar 2015 at 7:42

GoogleCodeExporter commented 9 years ago

Original comment by vale...@google.com on 18 Mar 2015 at 5:20

GoogleCodeExporter commented 9 years ago
The "..." in the build.gradle example is there to simplify it, although I'll 
add it because this is not the first time this is reported as a bug.

The missing matches() was already added.

And I added the ! to Hello World! to match the new project template from AS.

Original comment by jalc@google.com on 19 Mar 2015 at 5:47