Automatically accept all SDK licences

UPDATE 2021 This should be the accepted answer as its easy and upto date AndroidSDK can finally accept licenses. Go to Android\sdk\tools\bin yes | sdkmanager –licenses EDIT: as pointed out in the comments by @MoOx, on macOS, you can do yes | sudo ~/Library/Android/sdk/tools/bin/sdkmanager –licenses as pointed out in the comments by @pho, @mikebridge and … Read more

Failed to resolve: com.android.support:appcompat-v7:26.0.0

To use support libraries starting from version 26.0.0 you need to add Google’s Maven repository to your project’s build.gradle file as described here: https://developer.android.com/topic/libraries/support-library/setup.html allprojects { repositories { jcenter() maven { url “https://maven.google.com” } } } For Android Studio 3.0.0 and above: allprojects { repositories { jcenter() google() } }

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

How to manually include external aar package using Gradle for Android

Please follow below steps to get it working ( I have tested it up to Android Studio 2.2) Lets say you have kept aar file in libs folder. ( assume file name is cards.aar ) then in app build.gradle specify following and click sync project with Gradle files. Open Project level build.gradle and add flatDir{dirs … Read more

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

How to use ThreeTenABP in Android Project

Attention: This answer, while technically correct, is now out of date Java 8+ API desugaring support now available via Android Gradle Plugin 4.0.0+ (Also see Basil Bourque’s answer below) Development on the ThreeTenABP Library is winding down. Please consider switching to Android Gradle plugin 4.0, java.time.*, and its core library desugaring feature in the coming … Read more

tech