本文介绍了Andriod Gradle问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Andriod studio(最新的andriod Studio版本)中导入了一个应用程序,然后尝试了以下所有操作:再次卸载并安装JDK,为每个库重新应用,更新SDK管理器,代码在5-6之前年前,所以现在我正在尝试更新Gradle,而我无法解决此问题.

I imported an application in Andriod studio(the newest andriod studio version), and I tried everything like: uninstall and install the JDK again, re-apply for each library, updating the SDK manager, the code is before 5-6 years ago, so now im trying to update the Gradle and I couldn't fix this issue.

build.gradle(modules:app)

build.gradle(modules:app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 16
    buildToolsVersion "29.0.2"

    defaultConfig {
        applicationId "com.App"
        minSdkVersion 11
        targetSdkVersion 29
    }compile

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
    compileSdkVersion = 29
}

dependencies {
    implementation files('libs/asmack-issue-13.jar')
    implementation files('libs/gcm.jar')
    implementation files('libs/gson-1.7.1.jar')
    implementation files('libs/httpmime-4.1-beta1.jar')
    implementation files('libs/mediationsdk-6.4.17.jar')
    implementation files('libs/PayPalAndroidSDK.jar')
}

Gradle-wrapper.propertis

Gradle-wrapper.propertis

#Mon Jan 27 05:34:23 GST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

Project Gradle

Project Gradle

  // Top-level build file where you can add configuration options common to all sub-projects/modules.
    buildscript {
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.5.1'
        }
    }

    allprojects {
        repositories {
            google()
            jcenter()
        }
    }

错误

Total time: 12.797 secs
ERROR: Gradle DSL method not found: 'google()'
Possible causes:
The project 'App_copy' 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.5.1 and sync project

The project 'App_copy' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file

The build file may be missing a Gradle plugin.
Apply Gradle plugin

推荐答案

右键单击您的项目,单击打开模块设置",然后在左侧的区域中单击项目".它应该给你一些下拉菜单"Android Gradle Plugin Version"和"Gradle Version".确保前者处于3.5.1的原样,或者更改它直到它(或更高版本).您也可以更改第二个("Gradle版本"),但我不知道该怎么做.我的是5.4.1.

Right click on your project, click "Open Module Settings", then click "Project" in the segment on the left. It should give you some dropdowns "Android Gradle Plugin Version" and "Gradle Version". Make sure the former is at 3.5.1 like it should be, or change it until it is (or is a higher version). You COULD also change the second one ("Gradle Version"), but I don't know what to. Mine is at 5.4.1.

这篇关于Andriod Gradle问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 16:06