How i can fix ':app:checkDebugDuplicateClasses' Error - flutter

I ran into a problem, I need Jitsi Meet and DartSIPUa in the project, but when I put them together it gives a duplicate error, I attached the log below. Can you also explain to me why my Flutter project that has JitsiMeet uses react-native-webrtc?
I tried for a long time to find what the reason might be, as long as JitsiMeet works separately from DartSIPUa, everything is fine, but I need them in one app, how can I do this?
Thank you all in advance for your help.
Log: https://pastebin.com/2RT30qEs
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class org.webrtc.AndroidVideoDecoder found in modules classes.jar (org.webrtc:google-webrtc:1.0.28262) and libwebrtc.jar (com.facebook.react:react-native-webrtc:1.75.3-jitsi-4429568)
Duplicate class org.webrtc.AndroidVideoDecoder$1 found in modules classes.jar (org.webrtc:google-webrtc:1.0.28262) and libwebrtc.jar (com.facebook.react:react-native-webrtc:1.75.3-jitsi-4429568)

found a github issue
TLDR
I solved the two above problems as following:
First problem (:app:checkDebugDuplicateClasses)
solution was: Through android studio
File > Invalidate Caches/Restart...
Second problem (:app:mergeDebugJavaResource)
The solution was:
Due to the generated build file path exceeds the windows max path length of 255 characters.
Only trying to use short names to make sure the project path is not too long, solved the problem.
This is the path in my machine:
C:\Users\Hakim.gradle\caches\modules-2\files-2.1\io.flutter\x86_64_debug\1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119\1ae520cbbf7e14af867232784194366b3d1c3f34\x86_64_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.jar
You can find the path in your machine and change the long file name to short one.
else try downgrading your flutter version

Related

Bit.dev (Bit Harmony): `bit tag` command fails to complete

I was exporting my component to Bit.dev, when I got stuck at the bit tag --message command, with the error message: Failed task 1: "teambit.pkg/pkg:PackComponents" of env "teambit.harmony/node"
I have already ran the previous commands: bit link --rewire, bit compile and bit build --all prior. I would also like to mention that I have circular dependencies errors which I workaround with the --ignore-issues \"CircularDependencies\" flag.
Have anyone faced this issue before, and managed to solve it? Thanks in advance.

Groovy:General error during semantic analysis: java.lang.NoSuchMethodError:

Imported the gradle project from the "complete" folder and received the following error:
Groovy:General error during semantic analysis:
java.lang.NoSuchMethodError: 'org.codehaus.groovy.ast.expr.Expression org.codehaus.groovy.ast.tools.GeneralUtils.propX(org.codehaus.groovy.ast.expr.Expression, java.lang.String)'
I am using the latest version of Eclipse, 2020-12, with groovy tools installed.
From grails guide
https://guides.grails.org/gorm-without-grails/guide/index.html
Downloaded code sample from github
https://github.com/grails-guides/gorm-without-grails.git
It seems likely to be a version mismatch, but I cannot determine how to correct this problem.
I have tried to delete the offending file, src/main/groovy/demo/domain/Manufacturer.groovy, and the error appears on the file in this package on line 1.
The error does not appear in any other package. I have done the usual internet searches for resolutions that apply, but have thus far been unable to find a suitable solution. I am hopeful for a suggestion?
I think this error comes from an AST transform that references the older signature of GeneralUtils#propX. This method used to return Expression and was changed to return PropertyExpression.
The bridge method for binary compatibility was missing in groovy-eclipse. https://github.com/groovy/groovy-eclipse/commit/f6f448675d95f858b4ec65b6fc8e55f27ccaaa94

Why the app produced by flutter build web sometimes doesn't work?

I have 2 issues that only appear when executing flutter build web.
Sometimes flutter build web fails complaining (wrongly) about types that were not compatible (see below).
Sometimes the build process finishes but then the web app doesn't work: doesn't display anything and there are no messages in the console.
The error I mention is something like this:
% flutter build web
Target dart2js failed: Exception: lib/main.dart:24:31:
Error: A value of type 'ApiUsersRepository' can't be assigned to a variable of type 'UsersRepository'.
- 'ApiUsersRepository' is from 'package:my_app/api_users_repo.dart' ('lib/api_users_repo.dart').
- 'UsersRepository' is from 'lib/users_repo.dart'.
final UsersRepository usersRepository = ApiUsersRepository();
^
Error: Compilation failed.
The app is working in iOS and web when developing.
The solution
I changed all imports of my files like:
import 'package:my_app/users_repo.dart';
To:
import 'users_repo.dart';
More Details
Investigating the error about types, I found this issue, where the important part is this comment: after changing every import to relative format it resolves my problem.
So I did that, and it solved the 2 issues, the compilation error, and the runtime error.
for me I had to remove a package that was corrupted. c:\src\flutter.pub-cache\hosted\pub.dartlang.org\localstorage-4.0.0+1 Apparently, a file had become corrupted by me invertly. I removed the package and did a flutter pub get then recompiled and it worked.

How To Fix This Error [Error: Failed to find '#ionic/angular/css/display.css']

When i run the operation ionic serve it fails to compile and gives an error code that says:
ERROR in ./src/global.scss (./node_modules/#angular-devkit/build-
angular/src/angular-cli-files/plugins/raw-css-
loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/
sass-loader/lib/loader.js??ref--14-3!./src/global.scss)
Module build failed (from ./node_modules/postcss-loader/src/index.js):
Error: Failed to find '#ionic/angular/css/display.css'
in [
C:project/src
]
at resolveModule.catch.catch (project\node_modules\postcss-
import\lib\resolve-id.js:35:13)
This is a piece of code i tried to integrate into my own project which opens the camera to take a picture and you can either upload the picture or delete it. I tried searching for "#ionic/angular/css/display.css" on the internet but couldn't find a solution. I started ionic just recently so i don't understand much about it.
If anyone wants to see the code It is here The original i took it from had the code at home.page.ts but i needed it at tab1.page.ts so the error may be born from this. Also global.scss
The method i used to solve the problem is importing "#ionic/angular/css/display.css". I did it manually taking it from a project where it exists and copying it to the Project which gives the error.

How to remedy error caused by guava: Program type already present: com.google.common.util.concurrent.internal.InternalFutures

An AAR library already uses com.google.guava.
If an app includes the following in its build.gradle:
api 'com.google.guava:guava:27.0-android'
Building the app generates the following error:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: ...
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: com.google.common.util.concurrent.internal.InternalFutures
If I do not include "api 'com.google.guava:guava:27.0-android'", the app can be built, but it has runtime error of java.lang.NoClassDefFoundError when it reaches the point of using the Guava method: Iterables.find
I had to update to version 27.0.1, at the time of writing they still haven't updated the README with this new version.
implementation 'com.google.guava:guava:27.0.1-android'
Since Guava 27.0, ListenableFuture is located in separate artifact, see the announcement. You can try two things (one at a time):
Exclude "listenablefuture" module (group "com.google.guava") and build your project again.
I don't know the AAR specifics, but it could be that 27.0-android doesn't work with AAR, so you should try 26.0-android instead.