how to downgrade proguard version in android studio gradle? - android

I am trying to build an android app using scala and android studio.
The compile fails at proguard with an exception:
Error:java.lang.ArrayIndexOutOfBoundsException: 4
at proguard.classfile.editor.InterfaceDeleter.visitSignatureAttribute(InterfaceDeleter.java:162)
at proguard.classfile.attribute.SignatureAttribute.accept(SignatureAttribute.java:97)
I found at another place (http://sourceforge.net/p/proguard/bugs/549/) that this issue is caused by a bug in scala, but that it only occurs in proguard 5.1 and not in proguard 5.0.
Now my question is: how can I setup android studio so that it will use proguard 5.0?

Found it!
The trick is to exclude proguard 5.1 in the toplevel buildfile, and add a dependency on 5.0 instead.
Here is my toplevel build file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath ('com.android.tools.build:gradle:1.0.0') {
exclude module: 'proguard-gradle'
}
classpath "jp.leafytree.gradle:gradle-android-scala-plugin:1.3.1"
classpath ('net.sf.proguard:proguard-gradle:5.0') {
force = true
}
}
}
allprojects {
repositories {
jcenter()
}
}

Related

Android Studio - Build fails on compile, cannot find dsl.dependencies.DefaultDependencyHandler

Here's build.gradle:
C:\Users\billb\StudioProjects\ShoppingList03>type build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath "/com.android.tools.build.gradle:3.3/"
compile "com.android.support:support-core-utils:26.1.0"
}
}
allprojects {
repositories {
jcenter()
}
}
Error is on the compile: cannot find DefaultDependencyHandler.
I've reloaded Android SDK Platform-Tools and SDK Tools, both 26.0.1
Where is this DefaultDependencyHandler? Why is it required?
There's something in my android java code that requires this, evidently.
Any ideas out there? I've spent way too much time trying to track this down.
Add compile "com.android.support:support-core-utils:26.1.0" line in your app level build.gradle file instead of project level build.gradle file.

Firebase Performance Beta / Plugin build issue

When integrating the current Android Firebase Performance Monitoring (beta) version released during I/O 2017 as follows...
Add to project build.gradle:
dependencies {
classpath 'com.google.firebase:firebase-plugins:1.1.0'
}
Add to app build.gradle:
dependencies {
compile 'com.google.firebase:firebase-perf:10.2.6'
}
You may come across the following build error.
Error:Execution failed for task ':app:packageDebug'.
> com.google.common.util.concurrent.MoreExecutors.directExecutor()Ljava/util/concurrent/Executor;
This is caused by a Guava dependency mismatch, which can be resolved as follows, by modifying the project build.gradle as follows:
dependencies {
classpath ('com.google.firebase:firebase-plugins:1.1.0') {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
}
The Firebase team are aware of this issue, suggested the above workaround and will be fixing in a future release.
Putting this out there to help anyone else scratching their head.
This issue was fixed in version 1.1.1 of firebase plugins. To use the updated version just update your project-level build.gradle file as follows:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath ('com.google.firebase:firebase-plugins:1.1.1')
}
}

android Error:(44, 13) Failed to resolve com.esri.arcgis.android:arcgis-android:10.2.7

Every time I build my android project it gives me this Error
android Error:(44, 13) Failed to resolve com.esri.arcgis.android:arcgis-android:10.2.7
Can anyone help me regarding this ?
The problem is solved like that
1.
add the following lines
// Add the following ArcGIS repository
maven {
url 'https://esri.bintray.com/arcgis'
}
in the build.gradle of the project module
to be like that
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
//**Added .. for ArcGIS
maven {
url 'https://esri.bintray.com/arcgis'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
// Add the following ArcGIS repository
maven {
url 'https://esri.bintray.com/arcgis'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Also , I edited the version of arcgis dependency in the app module build.gradle to be like that
compile 'com.esri.arcgis.android:arcgis-android:10.2.8'
May be needful.
In the app module build.gradle file, within the dependencies block, add a directive to include the ArcGIS Runtime SDK for Android dependency to your app.
App module build.gradle file
Fallow all the steps from here
dependencies {
// Add ArcGIS Runtime SDK for Android dependency
compile 'com.esri.arcgis.android:arcgis-android:10.2.7'
}
This may be due to version mis-match of Android Studio. So, try giving latest dependencies in app level build.gradle. In my case I changed it from 10.2.6 to 10.2.8
compile 'com.esri.arcgis.android:arcgis-android:10.2.8'

Integrating Flurry on Android Studio: Gradle DSL Method not found - 'compile()'

I'm following the instructions for integrating Flurry Analytics using the official tutorial
I run into the problem that has been widely reported:
Error:(4, 0) Gradle DSL method not found: 'compile()'
Possible causes:The project 'My_Project' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper fileThe build file may be missing a Gradle plugin.
Apply Gradle plugin
Here's the gradle file for the FlurryAnalytics-5.5.0 module autogenerated by Studio:
configurations.create("default")
artifacts.add("default", file('FlurryAnalytics-5.5.0.jar'))
dependencies {
compile files('FlurryAnalytics-5.5.0.jar')
}
I'm aware that a common solution prescribed in such questions as this one is to avoid putting the 'dependencies' closure in the top level build file. However, I don't have any non-gradle dependencies in that file, as is shown below.
build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
The compile option is a part of the Android Gradle Plugin.
You need to apply that plugin to your module's build.gradle file if the module is an Android module.
apply plugin: 'com.android.application' // Android Gradle Pllugin
android {
// Your Android configuration
}
With Jar:
dependencies {
compile files('FlurryAnalytics-5.5.0.jar') // Your Jar
}
or Maven Dependency:
dependencies {
compile 'com.flurry.android:analytics:6.2.0' // Latest Jcenter release
}

Building android project with gradle

Im trying to build a simple android app using gradle build tools. but im getting an error like this
No signature of method: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.compile() is applicable for argument types: (java.lang.String) values: [org.gradle.api.plugins:gradle-android-plugin:1.2.0-SNAPSHOT]
Possible solutions: module(java.lang.Object)
ang here's a simple configuration of build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
compile 'org.gradle.api.plugins:gradle-android-plugin:1.2.0-SNAPSHOT'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
processResource {
expand (project.properties)
}
task configureDebug << {
jar.classifier = "debug"
}
task configureRelease << {
proguard.enabled = true
}
When applying a plugin you want tell you build script to use it in its classpath. It is not required for compilation so just change the configuration compile to classpath. More more information see 51.5.1. Using your plugin in another project in the Gradle user guide.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.gradle.api.plugins:gradle-android-plugin:1.2.0-SNAPSHOT'
}
}
EDIT: At the moment the plugin does not support r20 of the Android SDK. For more information see this issue.
Make sure you are writing the dependency block on your application build.gradle "YourProjectName->yourprojectname->build.gradle" in android studio hierarchy .
Use android gradle tools
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}

Categories

Resources