3

Since I update android gradle I have issues in my ringtone app, problem is in copying files and permissions I guess (I noticed that in manifest android.permission.WRITE_SETTINGS is underlined with red color, and I guess there is the problem)

Same code works perfectly in my old projects and the only difference is in gradle, so I tried some tutorials on net on how to downgrade it, but I have failed.

I tried in gradle-wrapper.properties(Gradle Version) to change

distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip

to the version that worked for me before, but I got message that 4.4 is minimum

then i tried to downgrade in build.gradle(Project)

but only succeeded to downgrade it to

classpath 'com.android.tools.build:gradle:3.0.1'

but that didn't solved my problem, because the working version was 2.3.3

with distributionUrl=https://services.gradle.org/distributions/gradle-3.3-all.zip

and when I tried to sync with 2.3.3 i got error

Gradle DSL method not found: 'google()'
Possible causes:<ul><li>The project 'MyProject' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Upgrade plugin to version 3.1.4 and sync project</li><li>The project 'MyProject' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file</li><li>The build file may be missing a Gradle plugin.
Apply Gradle plugin</li>

Can somebody tell me the proper way and step by step solution to my problem

somidurlan
  • 33
  • 1
  • 6

1 Answers1

1

Below are the steps you may try but this is not a good way of solving the problem. You better focus on the main issue and try to solve it. Start from here or find other workarounds.

1-Remove google() from build.gradle and add maven instead:(for Gradle lower than 4.1)

buildscript {
    repositories {
        maven {
            url 'https://maven.google.com'
        }
        jcenter()
    }
}

2-Go to gradle-wrapper.properties and change gradle version to:

distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

3-Change gradle plugin to(if you're using Android Studio 2.x.x):

dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
    }

4-Sync.

Akn
  • 421
  • 5
  • 9
  • This didn't worked. I agree that this is bad way to solve problem, but I couldn't find the solution so i tried to put back things like they were before. – somidurlan Sep 09 '18 at 03:59