Android studio hapi fhir validation, checkDebugDuplicateClasses error - android-studio

I am trying to build a simple android project in which I want to use some hapi-fhir dependencies. However, despite the built is successful, when I am running the application I get a duplicate classes error. The dependencies I am trying to add are the following:
implementation 'ca.uhn.hapi.fhir:hapi-fhir-base:4.1.0'
implementation 'ca.uhn.hapi.fhir:hapi-fhir-structures-dstu2:4.1.0'
implementation 'ca.uhn.hapi.fhir:hapi-fhir-structures-r4:4.1.0'
implementation 'ca.uhn.hapi.fhir:hapi-fhir-validation-resources-r4:4.1.0'
implementation group: 'ca.uhn.hapi.fhir', name: 'hapi-fhir-validation', version: '4.1.0'
After commenting out each one I conclude that the issue is deriving from the last one (hapi-fhir-validation).
I have also added this dependency to prevent some previous issue.
implementation 'androidx.multidex:multidex:2.0.1'
While running the failed tasks are the following:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class org.apache.commons.logging.Log found in modules jetified-commons-logging-1.2 (commons-logging:commons-logging:1.2) and jetified-jcl-over-slf4j-1.7.28 (org.slf4j:jcl-over-slf4j:1.7.28)
Duplicate class org.apache.commons.logging.LogConfigurationException found in modules jetified-commons-logging-1.2 (commons-logging:commons-logging:1.2) and jetified-jcl-over-slf4j-1.7.28 (org.slf4j:jcl-over-slf4j:1.7.28)
Duplicate class org.apache.commons.logging.LogFactory found in modules jetified-commons-logging-1.2 (commons-logging:commons-logging:1.2) and jetified-jcl-over-slf4j-1.7.28 (org.slf4j:jcl-over-slf4j:1.7.28)
Duplicate class org.apache.commons.logging.impl.NoOpLog found in modules jetified-commons-logging-1.2 (commons-logging:commons-logging:1.2) and jetified-jcl-over-slf4j-1.7.28 (org.slf4j:jcl-over-slf4j:1.7.28)
Duplicate class org.apache.commons.logging.impl.SimpleLog found in modules jetified-commons-logging-1.2 (commons-logging:commons-logging:1.2) and jetified-jcl-over-slf4j-1.7.28 (org.slf4j:jcl-over-slf4j:1.7.28)
Duplicate class org.apache.commons.logging.impl.SimpleLog$1 found in modules jetified-commons-logging-1.2 (commons-logging:commons-logging:1.2) and jetified-jcl-over-slf4j-1.7.28 (org.slf4j:jcl-over-slf4j:1.7.28)
Go to the documentation to learn how to Fix dependency resolution errors.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> More than one file was found with OS independent path 'META-INF/DEPENDENCIES'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 8s
Any advice on how to proceed will be very useful. Please let me know if you need any more information.
Thank you in advance!!

Currently made this work by importing the dependency while excluding the one that appeared as duplicate as follows:
implementation('ca.uhn.hapi.fhir:hapi-fhir-validation:4.1.0'){
exclude group: 'commons-logging', module: 'commons-logging'
}
instead of :
implementation 'ca.uhn.hapi.fhir:hapi-fhir-validation:4.1.0'

Related

Error while building function with KNative

I was trying to build a Serverless application with Knative while using Rust. The program run well locally after calling cargo build. However before deploying the project, I keep ending with the error below.
Installing function v0.1.0 (/workspace)
error: failed to get `actix-http` as a dependency of package `function v0.1.0 (/workspace)`
Caused by:
failed to load source for dependency `actix-http`
Caused by:
Unable to update registry `crates-io`
Caused by:
usage of sparse registries requires `-Z sparse-registry`
unable to invoke layer creator
unable to contribute application layer
unable to install single
unable to build
exit status 101
ERROR: failed to build: exit status 1
Error: failed to build the function: executing lifecycle: failed with status code: 51
Error: exit status 1
I've been looking for solutions to solve this without any luck. Can someone help me figure out how to resolve this issue?

Cargo error: unable to get packages from source

error: failed to download `adler v1.0.2`
Caused by:
unable to get packages from source
Caused by:
failed to parse manifest at `/home/actionanand/.cargo/registry/src/github.com-1ecc6299db9ec823/adler-1.0.2/Cargo.toml`
Caused by:
could not parse input as TOML
Caused by:
unexpected character found: `\u{0}` at line 1 column 1
Rust .toml file was full of red line when we add new dependency
This is caused by the crash of internal package (say cargo)
we can solve this by following the steps
Please clear the cargo registry
rm -rf /home/username/.cargo/registry/
And follow the proceedure shown after this, if you use old version
For the reference, I've given the proceedure also below:
If you are trying to migrate from the previous edition (2018), the
process requires following these steps:
1. Start with `edition = "2018"` in `Cargo.toml`
2. Run `cargo fix --edition`
3. Modify `Cargo.toml` to set `edition = "2021"`
4. Run `cargo build` or `cargo test` to verify the fixes worked
More details may be found at
https://doc.rust-lang.org/edition-guide/editions/transitioning-an-existing-project-to-a-new-edition.html
You may need to to add --allow-no-vcs sometimes (it'll be prompted by the terminal) as below
cargo fix --edition --allow-no-vcs

How do i fix this error of 'simple_permissions' on flutter?

There is an error when I run the code including simple_permissions on flutter project.
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
C:\Users\ria\Downloads\flutter_windows_v1.2.1-stable\flutter\.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:9: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
^
symbol: class ActivityCompat
location: package android.support.v4.app
C:\Users\ria\Downloads\flutter_windows_v1.2.1-stable\flutter\.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:10: error: package android.support.v4.content does not exist
import android.support.v4.content.ContextCompat;
^
C:\Users\ria\Downloads\flutter_windows_v1.2.1-stable\flutter\.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:156: error: cannot find symbol
ActivityCompat.requestPermissions(activity, perm, 0);
^
symbol: variable ActivityCompat
location: class SimplePermissionsPlugin
C:\Users\ria\Downloads\flutter_windows_v1.2.1-stable\flutter\.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:163: error: cannot find symbol
return PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(activity, permission);
^
symbol: variable ContextCompat
location: class SimplePermissionsPlugin
C:\Users\ria\Downloads\flutter_windows_v1.2.1-stable\flutter\.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:171: error: cannot find symbol
if (ActivityCompat.shouldShowRequestPermissionRationale(registrar.activity(), permission)) {
^
symbol: variable ActivityCompat
location: class SimplePermissionsPlugin
C:\Users\ria\Downloads\flutter_windows_v1.2.1-stable\flutter\.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:175: error: cannot find symbol
if (ActivityCompat.checkSelfPermission(registrar.context(), permission) == PackageManager.PERMISSION_GRANTED) {
^
symbol: variable ActivityCompat
location: class SimplePermissionsPlugin
6 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':simple_permissions:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
Finished with error: Gradle task assembleDebug failed with exit code 1
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
*******************************************************************************************
I was getting the same issue, after some searches I found this repository.
https://github.com/tq-systems/simple_permissions
This repository solved the AndroidX compatibility issues.
import it into the pubspec.yaml like that:
dependencies:
simple_permissions:
git:
url: https://github.com/tq-systems/simple_permissions.git
I got the same issue. I solved it with these step
Step 1 => Update your android studio to lastest version
download here
Step 2
Uninstall your android studio and install the new with new setting
Step 3
Add the Flutter plugin
Step 4
Add this to your depences in build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.google.gms:google-services:4.2.0'
classpath ('com.google.firebase:firebase-plugins:1.1.0') {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
}
Step 5
Run this command
flutter packages get
To update your packages and gradles
It worked fine for me.

Execution failed for task ':compileDebugJavaWithJavac'

I cannot build the app after i installed cordova googleMaps. Getting the following error "Execution failed for task ':compileDebugJavaWithJavac'.".
If i uninstall google maps then i would be able to build without any problem .
Complete error:
1 error
:compileDebugJavaWithJavac
FAILED
BUILD FAILED
Total time: 2.676 secs
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
Error: cmd: Command failed with exit code 1 Error output:
D:\Lenus Phase-2\lenus\platforms\android\src\plugin\google\maps\PluginUtil.java:
135: error: cannot access AbstractSafeParcelable
Builder builder = LatLngBounds.builder();
^
class file for com.google.android.gms.common.internal.safeparcel.AbstractSafeP
arcelable not found
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova run android (exit code 1).

Haskell Stack build error - ghc.exe: could not execute

Getting following error when trying to stack build snowdrift on Windows:
Linking .stack-work\dist\i386-windows\Cabal-1.18.1.5\build\SnowdriftEmailDaemon\SnowdriftEmailDaemon.exe ...
ghc.exe: could not execute: C:\Users\Razvan\AppData\Local\Programs\stack\i386-windows\ghc-7.8.4\lib/../mingw/bin/gcc.exe
Completed all 6 actions.
-- While building package Snowdrift-0.1.4 using:
C:\\Users\\Razvan\\AppData\\Local\\Programs\\stack\\i386-windows\\ghc-7.8.4\\bin\\runhaskell.exe -package=Cabal-1.18.1.5 -clear-package-db -global-package-db -package-db=C:\Users\Razvan\AppData\Roaming\stack\snapshots\i386-windows\lts-2.13\7.8.4\pkgdb\ C:\Users\Razvan\AppData\Local\Temp\stack124196\Setup.hs --builddir=.stack-work\dist\i386-windows\Cabal-1.18.1.5\ build
Process exited with code: ExitFailure 1
My question is how to obtain more information on this error as it is quite vague. Looking under .\.stack-work\logs I can't find any snowdrift related log. It is almost like setting the stack verbosity level to debug does not affect ghc/gcc verbosity level or maybe extra error information is just not there.
More information on the issue here.

Resources