问题
According to the Splunk MINT documentation (https://docs.splunk.com/Documentation/MintAndroidSDK/5.2.x/DevGuide/Requirementsandinstallation) you must manually download the Gradle plugin artifact and include it in your project.
I successfully downloaded and deployed this artifact to a local instance of Artifactory, since it's already archived in a maven repo format.
To test the integration, I simply created a brand new project and added/applied the mint plugin. From here, Gradle sync fails with the following error:
Caused by: java.lang.NoSuchFieldError: javacTask
at com.splunk.mint.gradle.android.plugin.utils.VariantUtilsKt.getJavaTask(VariantUtils.kt:13)
at com.splunk.mint.gradle.android.plugin.api.AspectJTransform.setupVariant(AspectJTransform.kt:81)
at com.splunk.mint.gradle.android.plugin.api.AspectJTransform$prepareProject$1.execute(AspectJTransform.kt:57)
at com.splunk.mint.gradle.android.plugin.api.AspectJTransform$prepareProject$1.execute(AspectJTransform.kt:43)
at org.gradle.configuration.internal.DefaultListenerBuildOperationDecorator$BuildOperationEmittingAction$1$1.run(DefaultListenerBuildOperationDecorator.java:150)
at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.reapply(DefaultUserCodeApplicationContext.java:58)
at org.gradle.configuration.internal.DefaultListenerBuildOperationDecorator$BuildOperationEmittingAction$1.run(DefaultListenerBuildOperationDecorator.java:147)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
at org.gradle.configuration.internal.DefaultListenerBuildOperationDecorator$BuildOperationEmittingAction.execute(DefaultListenerBuildOperationDecorator.java:144)
at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:91)
at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:80)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:230)
at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:149)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
... 126 more
Environment:
- Android Studio 3.4
- Gradle 5.2
- Android Gradle Plugin 3.4.0
- Splunk Mint Plugin 5.2.5
I suspect the Splunk team needs to update this plugin to support newer versions of Gradle. Unfortunately I'm unable to downgrade to a previous 4.x version since that is below the minumum supported version for Android Studio.
回答1:
I got the older version from the link http://download.splunk.com/misc/mint/mint-android-repo-5.1.0.zip and used check their installation https://www.youtube.com/watch?v=vecdk2HUASw, at least it can build, so i believe that 5.2 version has an issue
回答2:
Show build.gradle. I found that 2.5.2 works but you must add to the build.gradle app module instead of the library module... If you add to library module it won't work. Also removing the plugin works for me.
I found a solution to use Splunk on libraries too. Basically you need to use the parts that imports the file from uri in all your libraries. To do that I put the 'mint-plugin-repo-5.2.5' inside my common library and then, in my application project gradle, I went to parent directory '../' until I was in the repository directory and then I put the relative path to 'mint-plugin-repo-5.2.5' file in my common library (so, for example: '../../MyLibrary/lib-module/mint-plugin-repo-5.2.5).
Doing so with NO PLUGIN, MultiDex enable and min/target API inside my manifest I made it works in all parts of my project (1 module app + 2 module libraries)
Hope this is helpful
回答3:
Thankfully I got 5.2.5 working - was about to give up and use another crash reporting tool.
This is how I did it.
Step 1: Download the MINT plugin repository for Gradle (mint-android-repo-5.2.5.zip).
Step 2: Extract zip file into your Android project's "app" folder
Step 3: Modify your app Gradle build file (app/build.gradle) as follows:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "org.example"
minSdkVersion 24
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
...
}
buildscript {
repositories {
maven {
url uri('mint-plugin-repo-5.2.5')
}
mavenCentral()
}
dependencies {
classpath 'com.splunk:mint-gradle-android-plugin:5.2.5'
}
}
repositories {
maven {
url uri('mint-plugin-repo-5.2.5')
}
}
dependencies {
...
implementation 'com.splunk:mint-android-sdk:5.2.5'
}
Thanks for the other answers which helped.
I watched the video suggested (important installation information starts at 3:21) ... I also read their Android documentation ... and finally the solution was to remove their plugin!
As I am new to Mint/Splunk (at least in this decade) I am unsure of the impacts of this, but I tested and an app crash came through and appeared in my dashboard.
来源:https://stackoverflow.com/questions/55938833/how-do-i-install-the-splunk-mint-gradle-plugin