Montag, 7. November 2016

Multi dex requires Build Tools 21.0.0 / Current: 20

When trying to launch the sample app from https://github.com/pedrovgs/DraggablePanel, I encountered the issue:

 Multi dex requires Build Tools 21.0.0 / Current: 20

What is this error about?

In this case, the parent DraggablePanel project had gradle.properties defined, that were referring to an older SDK version:

ANDROID_BUILD_TOOLS_VERSION=21.0.0
ANDROID_COMPILE_SDK_VERSION=20


The sample project itself used those values inside the build.gradle file:

defaultConfig {
  versionName project.VERSION_NAME
  versionCode Integer.parseInt(project.VERSION_CODE)

  targetSdkVersion Integer.parseInt(project.ANDROID_TARGET_SDK_VERSION)
}

Changing the versions fixed the issue.

ANDROID_BUILD_TOOLS_VERSION=22.0.1
ANDROID_COMPILE_SDK_VERSION=21



Montag, 17. Oktober 2016

Could not find method groovy() for arguments

 Could not find method groovy() for arguments


If you encounter the error message Could not find method groovy() for arguments  e.g. in IntelliJ or running Gradle directly, there is a quick solution, but you migh not like is:


The groovy configuration has been deprecated and is scheduled to be removed in Gradle 2.0. Typically, usages of 'groovy' can simply be replaced with 'compile'. In some cases, it may be necessary to additionally configure the 'groovyClasspath' property of GroovyCompile and Groovydoc tasks."

Basically this means you go back to the latest Gradle 1.* or you simply update your gradle scripts.

It might also be, you have accidentally a normal IntelliJ project in AndroidStudio :-)

Montag, 1. Februar 2016

Android Studio. FAILURE: Build failed with an exception. Could not resolve https://

A common issue with Android Studio behind Corporate Firewalls is fetching dependencies from HTTPS Urls:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not resolve com.facebook.android:facebook-android-sdk:4.9.0.
     Required by:
         flirtbox_flirtbox-android:app:unspecified
      > Could not resolve com.facebook.android:facebook-android-sdk:4.9.0.
         > Could not get resource 'https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/4.9.0/facebook-android-sdk-4.9.0.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/4.9.0/facebook-android-sdk-4.9.0.pom'.
               > Connection to https://jcenter.bintray.com refused
      > Could not resolve com.facebook.android:facebook-android-sdk:4.9.0.
         > Could not get resource 'https://oss.sonatype.org/content/repositories/snapshots/com/facebook/android/facebook-android-sdk/4.9.0/facebook-android-sdk-4.9.0.pom'.
            > Could not GET 'https://oss.sonatype.org/content/repositories/snapshots/com/facebook/android/facebook-android-sdk/4.9.0/facebook-android-sdk-4.9.0.pom'.
               > Connection to https://oss.sonatype.org refused
      > Could not resolve com.facebook.android:facebook-android-sdk:4.9.0.
         > Could not get resource 'https://maven.fabric.io/public/com/facebook/android/facebook-android-sdk/4.9.0/facebook-android-sdk-4.9.0.pom'.
            > Could not GET 'https://maven.fabric.io/public/com/facebook/android/facebook-android-sdk/4.9.0/facebook-android-sdk-4.9.0.pom'.
               > Connection to https://maven.fabric.io refused

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

The easy solution is to tick the checkbox that says, Android Studio should fallback to http instead of https:

Android Studio / Build failed due to HTTPS dependencies