Feature Idea: Android Jack Compiler Compatibility

New Relic does not appear to work when compiling with the Android Jack compiler.
You can see that the New Relic prints error logs during the App’s launch activity creation:

Android Studio logcat

01-05 17:13:41.675 21213-21213/? I/com.newrelic.agent.android: isInstrumented: checking for Mono instrumentation flag - NO
01-05 17:13:41.675 21213-21213/? E/com.newrelic.agent.android: Failed to detect New Relic instrumentation.  Something likely went wrong during your build process and you should visit http://support.newrelic.com.
01-05 17:17:21.210 21213-21213/com.example.pshaw.testnewrelic D/CLIPBOARD: Hide Clipboard dialog at Starting input: finished by someone else... !
01-05 17:17:32.000 21213-21213/com.example.pshaw.testnewrelic D/CLIPBOARD: Hide Clipboard dialog at Starting input: finished by someone else... !
01-05 17:17:51.065 21213-21213/com.example.pshaw.testnewrelic I/com.newrelic.agent.android: isInstrumented: checking for Mono instrumentation flag - NO
01-05 17:17:51.065 21213-21213/com.example.pshaw.testnewrelic E/com.newrelic.agent.android: Failed to detect New Relic instrumentation.  Something likely went wrong during your build process and you should visit http://support.newrelic.com.

build.gradle (project level):

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath "com.newrelic.agent.android:agent-gradle-plugin:5.7.1"
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
    }
}

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

build.gradle (app level):
Note that removing the jackOptions block allows New Relic to work again.

apply plugin: 'com.android.application'
apply plugin: 'newrelic'
android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.pshaw.testnewrelic"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        jackOptions {
            enabled true
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.newrelic.agent.android:android-agent:5.7.1'
}

Note that the topic is different to the link below in that it specifically concerns the use of New Relic with the Android Jack compiler:


New Relic edit

  • I want this, too
  • I have more info to share (reply below)
  • I have a solution for this

0 voters

We take feature ideas seriously and our product managers review every one when plotting their roadmaps. However, there is no guarantee this feature will be implemented. This post ensures the idea is put on the table and discussed though. So please vote and share your extra details with our team.

Thanks for adding this feature idea, @pshaw! I will be passing this input along - be sure to also vote in the poll I have added! Thanks again for sharing such great context! :thumbsup:

1 Like

Since Google has a announced a change in direction regarding Java 8 support and the Jack toolchain, compatibility with this feature is no longer needed.

2 Likes

Do you know when Android’s 2.4 gradle tools will be supported? Their last three previews support Java 8 features, but New Relic’s Android SDK does not work with the latest preview builds of the gradle tools (regardless of enabling Java 8 compilation).

@spotts ^^ Can you give an update on this? Or direct me to someone who can?

@mike.cole Our agent is only supported with stable release versions of the Android plugin for Gradle. We do plan to support version 2.4 once it has been release to stable.

Java 8 is currently supported for build. If using Java 8 language features, Retrolambda is required.