0

在 ReactNative 中实现 Dynatrace,使用插件时出现错误。

下面是 build.graddle 文件中的配置

 buildscript {
    ext {
        googlePlayServicesVersion = "16.0.1"
    }
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.1.0'        
        classpath 'com.dynatrace.tools:android:7.2.+'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    } 
} 
apply plugin: 'com.dynatrace.tools.android' 
dynatrace {     
    defaultConfig {         
        applicationId 'shhsksksss-6ddf-djjs-skjs-383jkksks'
        environmentId 'sjhksjks'        
        cluster 'https://bf.dynatrace.com'  
    }
}

allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter {
            url "http://jcenter.bintray.com/"
        }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        maven { url "https://jitpack.io" }
    } 
 } 
 subprojects { 
     afterEvaluate { 
         project -> if (project.hasProperty("android")) { 
             android { 
                compileSdkVersion 28 
                buildToolsVersion '28.0.3' 
             } 
         } 
     }   } ext {
    buildToolsVersion = "28.0.3"
    minSdkVersion = 16
    compileSdkVersion = 28
    targetSdkVersion = 28
    supportLibVersion = "28.0.0" }

以下是运行命令“react-native run-android”时在控制台中出现的错误

Scanning folders for symlinks in /Users/absyz/Desktop/MyHub/myhub-app/node_modules (30ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/Dev/Desktop/appname/android/build.gradle' line: 23

* What went wrong:
A problem occurred evaluating root project 'ProjectName'.
> Failed to apply plugin [id 'com.dynatrace.tools.android']
   > Extension of type 'AppExtension' does not exist. Currently registered extension types: [ExtraPropertiesExtension, DynatraceConfig_Decorated]

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more logoutput. Run with --scan to get full insights.

* Get more help at https://help.gradle.org
4

0 回答 0