首页 > 解决方案 > 找不到 Gradle DSL 方法:'execute()'

问题描述

我试图运行一个我已经一年没有开发的项目。我确实更新了 Gradle,现在我遇到了这个错误。我尝试了很多方法来解决这个问题,但无论我做什么,我都找不到 Gradle DSL 方法:'execute()' 错误我使用的是 Android Studio 3.4.2。我确实尝试将 compileSdkVersion 从 27 更新到 28,然后我得到 Manifest 合并失败并出现多个错误,请参阅日志错误。

申请

plugin: 'com.android.application'


android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "ir.ypg.technoopshop"
        minSdkVersion 17
        targetSdkVersion 27
        manifestPlaceholders = [
                onesignal_app_id               : '5ce2a7f9-2ad0-4037-9787-9f20dcac9099',
                // Project number pulled from dashboard, local value is ignored.
                onesignal_google_project_number: 'REMOTE'
        ]
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:27.+'
    implementation 'com.android.support:design:27.+'
    implementation 'com.android.support:support-vector-drawable:27.+'
    implementation 'com.android.support:support-v4:27.+'
    implementation 'com.ss.bannerslider:bannerslider:1.8.0'
    implementation 'com.android.support:cardview-v7:27.+'
    implementation 'com.squareup.picasso:picasso:2.5.0'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.github.florent37:arclayout:1.0.3'
    implementation 'com.flaviofaria:kenburnsview:1.0.7'
    implementation 'com.allenliu.badgeview:library:1.1.1'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'cn.jzvd:jiaozivideoplayer:6.2.8'
    implementation 'com.airbnb.android:lottie:2.5.4'
    implementation 'com.karumi:dexter:4.2.0'
    implementation 'com.daimajia.slider:library:1.1.5@aar'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'com.github.michael-rapp:android-material-dialog:4.0.3'
    implementation 'com.daimajia.slider:library:1.1.5'
    implementation 'jp.wasabeef:recyclerview-animators:2.2.2'
    implementation 'io.supercharge:shimmerlayout:2.1.0'
    implementation 'com.getkeepsafe.taptargetview:taptargetview:1.10.0'
    implementation 'com.nineoldandroids:library:2.4.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    implementation 'com.google.android.gms:play-services-maps:11.0.4'
    implementation 'com.google.android.gms:play-services-location:11.0.4'
    implementation 'net.wujingchao.android.view:simple-tag-imageview:1.0.1'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
    implementation 'br.com.simplepass:loading-button-android:+'
    implementation 'com.google.firebase:firebase-core:11.0.4'
    implementation 'com.wang.avi:library:2.1.3'
    implementation 'com.scottyab:aescrypt:0.0.1'
    implementation 'com.veinhorn.scrollgalleryview:library:1.0.8'
    implementation 'com.yarolegovich:sliding-root-nav:1.1.0'
    implementation 'me.yuqirong:cardswipelayout:1.0.0'
    implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
}
apply plugin: 'org.fabiomsr.drawableoptimizer'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

// 顶级构建文件,您可以在其中添加所有子项目/模块通用的配置选项。

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

        }
        maven { url 'https://plugins.gradle.org/m2/' }
        maven {
            url 'https://maven.fabric.io/public'
        }
        google()

    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.11.0, 0.99.99]'
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath 'org.fabiomsr:drawable-optimizer-gradle-plugin:1.0.4'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.1.0'
    }
}
allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        maven { url 'https://maven.google.com' }
        maven { url "https://jitpack.io" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

gradle-wrapper.properties

#Tue Jul 23 21:38:15 PKT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="ir.ypg.technoopshop">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.USE_FINGERPRINT" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

    <application
        android:name=".other.MyApp"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".activites.MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".activites.register" />
        <activity android:name=".activites.list.Phone_list" />

        <!--
             The API key for Google Maps-based APIs is defined as a string resource.
             (See the file "res/values/google_maps_api.xml").
             Note that the API key is linked to the encryption key used to sign the APK.
             You need a different API key for each encryption key, including the release key that is used to
             sign the APK for publishing.
             You can define the keys for the debug and release targets in src/debug/ and src/release/.
        -->
        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="AIzaSyB9rYuq5eL_-TT3X2s3nYvufEGAro5Y0" />

        <activity
            android:name=".activites.map"
            android:label="@string/title_activity_map" />
        <activity
            android:name=".activites.product.product_phone"
            android:theme="@style/Theme.AppCompat.NoActionBar">
            <intent-filter android:label="@string/app_name">
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data
                    android:host="technoop.ir"
                    android:pathPrefix="/phone"
                    android:scheme="http" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
            android:theme="@style/Base.Theme.AppCompat" />
        <activity
            android:name=".activites.videoview"
            android:configChanges="orientation|screenSize|keyboardHidden"
            android:screenOrientation="landscape" />
        <activity android:name=".activites.Threed_object" />
        <activity
            android:name=".activites.Gallery"
            android:theme="@style/AppTheme.ActionBar.Transparent" />
        <activity android:name=".activites.Search"
            android:theme="@style/AppTheme.NoActionBar"/>
        <activity
            android:name=".activites.Special_deal"
            android:theme="@style/AppTheme" />
        <activity
            android:name=".activites.Setting"
            android:theme="@style/AppTheme" />
        <activity android:name=".activites.Support"></activity>
    </application>

</manifest>

标签: androidandroid-studiogradleandroid-gradle-plugin

解决方案


推荐阅读