32
Views
6
Comments
Solved
[MSAL Plugin] Not able to generate APK using V 4.0.0
msal-plugin
Mobile icon
Forge asset by Walter Robins
Application Type
Mobile

Not able to generate the APK for the mobile app

1. Deleted all msal plugin and did a fresh install

2. Checked all dependencies

When generating the app getting below error


[2024-03-01T11:16:43.617Z] [ERROR] [Build] * What went wrong:

[2024-03-01T11:16:43.617Z] [ERROR] [Build] Execution failed for task ':app:checkDebugAarMetadata'.

[2024-03-01T11:16:43.617Z] [ERROR] [Build] > Could not resolve all files for configuration ':app:debugRuntimeClasspath'.

[2024-03-01T11:16:43.617Z] [ERROR] [Build]    > Could not resolve io.opentelemetry:opentelemetry-bom:1.18.0.

[2024-03-01T11:16:43.617Z] [ERROR] [Build]      Required by:

[2024-03-01T11:16:43.617Z] [ERROR] [Build]          project :app > com.microsoft.identity.client:msal:4.9.2

[2024-03-01T11:16:43.617Z] [ERROR] [Build]       > No matching variant of io.opentelemetry:opentelemetry-bom:1.18.0 was found. The consumer was configured to find a library for use during runtime, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.2.0', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:

[2024-03-01T11:16:43.617Z] [ERROR] [Build]           - Variant 'apiElements' capability io.opentelemetry:opentelemetry-bom:1.18.0:

[2024-03-01T11:16:43.617Z] [ERROR] [Build]               - Incompatible because this component declares a platform for use during compile-time and the consumer needed a library for use during runtime

[2024-03-01T11:16:43.617Z] [ERROR] [Build]               - Other compatible attributes:

[2024-03-01T11:16:43.617Z] [ERROR] [Build]                   - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.2.0')

[2024-03-01T11:16:43.617Z] [ERROR] [Build]                   - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')

[2024-03-01T11:16:43.617Z] [ERROR] [Build]                   - Doesn't say anything about its target Java environment (preferred optimized for Android)

[2024-03-01T11:16:43.617Z] [ERROR] [Build]                   - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')

[2024-03-01T11:16:43.617Z] [ERROR] [Build]           - Variant 'enforcedApiElements' capability io.opentelemetry:opentelemetry-bom-derived-enforced-platform:1.18.0:

[2024-03-01T11:16:43.617Z] [ERROR] [Build]               - Incompatible because this component declares an enforced platform for use during compile-time and the consumer needed a library for use during runtime

[2024-03-01T11:16:43.617Z] [ERROR] [Build]               - Other compatible attributes:

[2024-03-01T11:16:43.617Z] [ERROR] [Build]                   - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.2.0')

[2024-03-01T11:16:43.617Z] [ERROR] [Build]                   - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')

[2024-03-01T11:16:43.617Z] [ERROR] [Build]                   - Doesn't say anything about its target Java environment (preferred optimized for Android)

[2024-03-01T11:16:43.617Z] [ERROR] [Build]                   - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')

[2024-03-01T11:16:43.617Z] [ERROR] [Build]           - Variant 'enforcedRuntimeElements' capability io.opentelemetry:opentelemetry-bom-derived-enforced-platform:1.18.0 declares a component for use during runtime:

[2024-03-01T11:16:43.617Z] [ERROR] [Build]               - Incompatible because this component declares an enforced platform and the consumer needed a library

[2024-03-01T11:16:43.617Z] [ERROR] [Build]               - Other compatible attributes:

[2024-03-01T11:16:43.617Z] [ERROR] [Build]                   - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.2.0')

[2024-03-01T11:16:43.617Z] [ERROR] [Build]                   - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')

[2024-03-01T11:16:43.617Z] [ERROR] [Build]                   - Doesn't say anything about its target Java environment (preferred optimized for Android)

[2024-03-01T11:16:43.617Z] [ERROR] [Build]                   - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')

[2024-03-01T11:16:43.617Z] [ERROR] [Build]           - Variant 'runtimeElements' capability io.opentelemetry:opentelemetry-bom:1.18.0 declares a component for use during runtime:

[2024-03-01T11:16:43.617Z] [ERROR] [Build]               - Incompatible because this component declares a platform and the consumer needed a library

[2024-03-01T11:16:43.617Z] [ERROR] [Build]               - Other compatible attributes:

[2024-03-01T11:16:43.617Z] [ERROR] [Build]                   - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.2.0')

[2024-03-01T11:16:43.617Z] [ERROR] [Build]                   - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')

[2024-03-01T11:16:43.617Z] [ERROR] [Build]                   - Doesn't say anything about its target Java environment (preferred optimized for Android)

[2024-03-01T11:16:43.617Z] [ERROR] [Build]                   - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')

[2024-03-01T11:16:43.617Z] [ERROR] [Build] * Try:

[2024-03-01T11:16:43.617Z] [ERROR] [Build] > Run with --stacktrace option to get the stack trace.

[2024-03-01T11:16:43.617Z] [ERROR] [Build] > Run with --info or --debug option to get more log output.

[2024-03-01T11:16:43.617Z] [ERROR] [Build] > Run with --scan to get full insights.



It clearly says issue with consumer and producer about runtime and buildtime but not able to pinpoint what is going wrong here.

2015-09-02 13-43-32
Walter Robins
Solution

Hello!

This issue was unfortunately introduced in MABS 10, although it is actually a problem with the native Android MSAL library building on newer versions of Gradle (>=8.2), which is what MABS 10 runs. Fortunately, this is a known issue and has been fixed by the developers of that library.

To fix this, update the plugin URL in your extensibility configuration to use either the latest or v4.1.1 from git

"plugin": {

        "url": "https://github.com/wrobins/cordova-plugin-msal.git",

       ...

or

"plugin": {

        "url": "https://github.com/wrobins/cordova-plugin-msal.git#v4.1.1",

       ...

This will pull the latest 5.1.x of the native Android library where they fixed that issue and your app should build.

UserImage.jpg
Lakshay Verma

Hi Walter,


Thanks for the quick update.

I tried updating it but got below error.
I am not sure, if this is a issue with graddel or not but I get below error now.


[2024-03-01T16:29:30.900Z] [VERBOSE] [Build] Preparing "Install Android SDK Platform 34 (revision: 3)".

[2024-03-01T16:29:30.900Z] [VERBOSE] [Build] Warning: Failed to read or create install properties file.

[2024-03-01T16:29:31.001Z] [VERBOSE] [Build] FAILURE: Build failed with an exception.

[2024-03-01T16:29:31.001Z] [VERBOSE] [Build] * What went wrong:

[2024-03-01T16:29:31.001Z] [VERBOSE] [Build] Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.

[2024-03-01T16:29:31.001Z] [VERBOSE] [Build] > Failed to install the following SDK components:

[2024-03-01T16:29:31.002Z] [VERBOSE] [Build]       platforms;android-34 Android SDK Platform 34

[2024-03-01T16:29:31.002Z] [VERBOSE] [Build]   The SDK directory is not writable (/opt/android-sdk)

[2024-03-01T16:29:31.002Z] [VERBOSE] [Build] * Try:

[2024-03-01T16:29:31.002Z] [VERBOSE] [Build] > Run with --stacktrace option to get the stack trace.

[2024-03-01T16:29:31.002Z] [VERBOSE] [Build] > Run with --info or --debug option to get more log output.

[2024-03-01T16:29:31.002Z] [VERBOSE] [Build] > Run with --scan to get full insights.

[2024-03-01T16:29:31.002Z] [VERBOSE] [Build] * Get more help at https://help.gradle.org

[2024-03-01T16:29:31.008Z] [VERBOSE] [Build] BUILD FAILED in 15s

[2024-03-01T16:29:31.008Z] [VERBOSE] [Build] Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

[2024-03-01T16:29:31.008Z] [VERBOSE] [Build] You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

[2024-03-01T16:29:31.008Z] [VERBOSE] [Build] See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings

[2024-03-01T16:29:31.557Z] [VERBOSE] [Build] Command failed with exit code 1: source/platforms/android/gradlew cdvBuildDebug -b source/platforms/android/build.gradle --parallel

[2024-03-01T16:29:31.560Z] [VERBOSE] [Build] Error: Command failed with exit code 1: source/platforms/android/gradlew cdvBuildDebug -b source/platforms/android/build.gradle --parallel

[2024-03-01T16:29:31.560Z] [VERBOSE] [Build]     at makeError (source/node_modules/execa/lib/error.js:60:11)

[2024-03-01T16:29:31.560Z] [VERBOSE] [Build]     at handlePromise (source/node_modules/execa/index.js:118:26)

[2024-03-01T16:29:31.560Z] [VERBOSE] [Build]     at processTicksAndRejections (node:internal/process/task_queues:96:5)

[2024-03-01T16:29:31.561Z] [VERBOSE] [Build]     at async ProjectBuilder.build (source/node_modules/cordova-android/lib/builders/ProjectBuilder.js:330:20)

[2024-03-01T16:29:31.714Z] [INFO] [Build] Remove generated Android build files

[2024-03-01T16:29:31.715Z] [INFO] [Build] Remove debug/release signing properties

[2024-03-01T16:29:31.900Z] [INFO] [Build] Zipping application source code...

[2024-03-01T16:29:52.919Z] [INFO] [Build] Saving package and source files...



I appreciate your time involvement in that.

2015-09-02 13-43-32
Walter Robins

Hi Lakshay,

That error looks like there might be an issue with another Cordova plugin in your application not supporting the target Android SDK version. Make sure all your other plugins are up to date in the Forge. If they all are, check all the ones that aren't supported plugins (i.e. not published by OutSystems). This might take some Googling and checking their linked git repos, but my guess is one of them isn't compatible with the latest MABS/target SDK, and that fixing MSAL simply allowed the build process to complete further and expose this new error.

UserImage.jpg
Lakshay Verma

HI Walter,


Thanks, I will do a complete reset on my account and re-try this.

I appreciate your quick response and helping the forum member to learn.


Best Regards,

Lakshay Verma

UserImage.jpg
Lakshay Verma

Hi Walter, 


It worked for me, not sure what the reason was...

But just to add

1. I have changed the URL to https://github.com/wrobins/cordova-plugin-msal.git  - 4.1.1 did not work for me

2. I have re-created the keystore file and added newly file while apk generation and updated the hash in the config

And next generation was successful with login success as well.


Thanks for your help again.

2015-09-02 13-43-32
Walter Robins

Very good - I'm glad it's working for you now!


Cheers,

Walt

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.