cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Failed to apply plugin [id 'com.dynatrace.tools.android']

gsood
Newcomer


In a react project we are implementing dynatrace, But getting issue in the build.graddle file when running. Below is the build.graddle file.


<code> 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 'App Id'
environmentId 'EnvId'
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"}

Below is the error getting:


Scanning folders for symlinks in/Users/Dev/Desktop/app/node_modules (30ms)
JS server already running.Buildingand 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:Runwith--stacktrace option to get the stack trace.Runwith--info or--debug option to get more logoutput.Runwith--scan to get full insights.*Get more help at https://help.gradle.org

2 REPLIES 2

matthias_hochri
Dynatrace Pro
Dynatrace Pro

Did you include the Android Gradle Plugin? Because that is needed for our plugin to work. Be aware that we are not supporting React native officially. If this doesn't work out instrument the .apk manually over the instrument.cmd.


Thomas_Wirth1
Dynatrace Pro
Dynatrace Pro

Hi @Gourav S.,

I assume that you have added the Dynatrace configuration in the project's build.gradle file instead of the module's build.gradle file. The Dynatrace Gradle plugin must be applied after the Android Gradle plugin.

        

// first apply the application module from the Android Gradle plugin


apply plugin: 'com.android.application'

...

// somewhere below, apply the Dynatrace Gradle plugin


apply plugin:'com.dynatrace.tools.android'


dynatrace {
defaultConfig {
applicationId 'App Id'
environmentId 'EnvId'
cluster 'https://bf.dynatrace.com'
}
}