2

I am trying to update the microsoft-graph-api to 3.3.0 and everything works in the Emulator, but the real device is an Android 7.0 (API 24) and I get: com.android.tools.r8.a: MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26)

Execution failed for task ':app:mergeExtDexDebug'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Failed to transform azure-core-1.15.0.jar (com.azure:azure-core:1.15.0) to match attributes {artifactType=android-dex, dexing-enable-desugaring=true, dexing-incremental-transform=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}. > Execution failed for DexingNoClasspathTransform: /Users/pmartinez/.gradle/caches/transforms-2/files-2.1/8cfc8780442b4f1e0ebead042ade0764/jetified-azure-core-1.15.0.jar. > Error while dexing.

The Readme from 3.3.0 says that developers trying to use it in <26 API could make it work using desugarizing, this is in my Gradle.app

compileOptions {
    // Flag to enable support for the new language APIs
    coreLibraryDesugaringEnabled true
    // Sets Java compatibility to Java 8
    sourceCompatibility = 1.8
    targetCompatibility = 1.8
}
dependencies {
// To get features from Newer APIs
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.9'
    implementation "com.microsoft.identity.client:msal:2.+"
    implementation 'com.microsoft.graph:microsoft-graph:3.3.0'
    // Uncomment the line below if you are building an android application
    implementation 'com.google.guava:guava:29.0-android'
}

Any ideas on what I could do to keep the graph 3 and/or whats the microsoft-graph 2 minimum Android API?

Dada
  • 6,313
  • 7
  • 24
  • 43

1 Answers1

2

You can try minifying the apk. It would remove unnecessary code and that method call may be unnecessary, even though graph api includes it. Here is an example:

buildTypes
{
  release
  {
    minifyEnabled true
  }
  debug
  {
    minifyEnabled true
  }
}
Numan Karaaslan
  • 1,365
  • 1
  • 17
  • 25