DexIndexOverflowException Only When Running Tests

com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536 Android application (APK) files contain executable bytecode files in the form of Dalvik Executable (DEX) files, which contain the compiled code used to run your app. The Dalvik Executable specification limits the total number of methods that can be referenced within a single DEX file to 65,536, … Read more

Error retrieving parent for item: No resource found that matches the given name after upgrading to AppCompat v23

Your compile SDK version must match the support library’s major version. Since you are using version 23 of the support library, you need to compile against version 23 of the Android SDK. Alternatively you can continue compiling against version 22 of the Android SDK by switching to the latest support library v22.

Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat

Run gradle -q dependencies (or gradle -q :projectName:dependencies) to generate a dependency report. You should see where r7 is coming from, such as: compile – Classpath for compiling the main sources. +— com.commonsware.cwac:camera-v9:0.5.4 | +— com.actionbarsherlock:actionbarsherlock:4.4.0 | | \— com.google.android:support-v4:r7 | +— com.commonsware.cwac:camera:0.5.4 | \— com.android.support:support-v4:18.0.+ -> 18.0.0 \— com.android.support:support-v4:18.0.+ -> 18.0.0 Then, use the … Read more

OpenCV in Android Studio

The below steps for using Android OpenCV sdk in Android Studio. This is a simplified version of this(1) SO answer. Download latest OpenCV sdk for Android from OpenCV.org and decompress the zip file. Import OpenCV to Android Studio, From File -> New -> Import Module, choose sdk/java folder in the unzipped opencv archive. Update build.gradle … Read more

Using Gradle to find dependency tree

Without modules: gradle dependencies For Android: gradle app:dependencies Using gradle wrapper: ./gradlew app:dependencies Note: Replace app with the project module name. Additionally, if you want to check if something is compile vs. testCompile vs androidTestCompile dependency as well as what is pulling it in: ./gradlew :app:dependencyInsight –configuration compile –dependency <name> ./gradlew :app:dependencyInsight –configuration testCompile –dependency … Read more

What’s the difference between implementation, api and compile in Gradle?

tl;dr Just replace: compile with implementation (if you don’t need transitivity) or api (if you need transitivity) testCompile with testImplementation debugCompile with debugImplementation androidTestCompile with androidTestImplementation compileOnly is still valid. It was added in 3.0 to replace provided and not compile. (provided introduced when Gradle didn’t have a configuration name for that use-case and named … Read more