React Native - Android Animated WebP is not working - android

I am trying to play an animated webp file on android devices. I am using react-native-animated-webp package but I got an error while building the app.
When I added the following lines into app/build.gradle file:
implementation("com.facebook.fresco:fresco:2.0.0")
// For animated GIF support
implementation 'com.facebook.fresco:animated-gif:2.0.0'
// For WebP support, including animated WebP
implementation 'com.facebook.fresco:animated-webp:2.3.0'
implementation 'com.facebook.fresco:webpsupport:2.3.0'
I got this error :
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
java.lang.RuntimeException: Duplicate class com.facebook.imagepipeline.cache.CountingMemoryCacheInspector found in modules imagepipeline-base-2.3.0-runtime.jar (com.facebook.fresco:imagepipeline-base:2.3.0) and stetho-2.0.0-runtime.jar (com.facebook.fresco:stetho:2.0.0)
Duplicate class com.facebook.imagepipeline.cache.CountingMemoryCacheInspector$DumpInfo found in modules imagepipeline-base-2.3.0-runtime.jar (com.facebook.fresco:imagepipeline-base:2.3.0) and stetho-2.0.0-runtime.jar (com.facebook.fresco:stetho:2.0.0)
Duplicate class com.facebook.imagepipeline.cache.CountingMemoryCacheInspector$DumpInfoEntry found in modules imagepipeline-base-2.3.0-runtime.jar (com.facebook.fresco:imagepipeline-base:2.3.0) and stetho-2.0.0-runtime.jar (com.facebook.fresco:stetho:2.0.0)
Is there anyone who faced this issue before? How can I solve it?

I upgraded Flipper Version to FLIPPER_VERSION=0.99.0 then Fresco version from 2.0.0 to 2.5.0 then cd android && ./gradlew clean it worked for me

Related

Using gradle implementation of my flavoured Library causes java.lang.NoClassDefFoundError

Hey everyone I have my own developed SDK in where I few external libraries, everything works fine if the flavour is default type but issue occurs when i change the flavour then I get java.lang.NoClassDefFoundError: Failed resolution of: Lcom/github/mikephil/charting/data/LineData;
and on every library that is implemented in my SDK
i searched all over and couldn't find any solution to it
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/github/mikephil/charting/data/LineData;

How to download file using volleyplus library

I am using volley com.android.volley:volley:1.1.0 library to make normal requests and it is working fine. Now required is to download a pdf file too. For that I need to use volleyplus dev.dworks.libs:volleyplus:+
Now since I have added duplicate libraries it gives me error like
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
Compilation failed; see the compiler error output for details.
Also none of the volley class reference is found in the code.
So, how to achieve both the functionality?
There is nt any kind of image caching related requirements.
First of all => invalidate cache and restart if not work then
Once I was found this error. This error mean you have duplicated library but different version in your project.
Such as :
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.okhttp3:okhttp:3.y.y'
I have add "Retrofit2" and "OkHttp3" together but in "Retrofit" already included OkHttp3 with 3.x.x version but another OkHttp3 I have add is not 3.x.x but 3.y.Y version so it's different and show error
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. Compilation failed; see the compiler error output for details.
Please make sure don't have some duplicated library like this with Dependency tree

Play-Services-Maps and Android Studio 3.3 issue with AndroidX involving Annotation library

I've recently updated my project to build from Android Studio 3.3, which involved making the following changes (prompted on Android Studio startup):
build.gradle dependency:
classpath 'com.android.tools.build:gradle:3.3.0'
gradle-wrapper:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
This produced a number of errors in a feature module when trying to sync which uses Google Maps. I'm using version 16.0.0 of play-services-maps:
implementation "com.google.android.gms:play-services-maps:16.0.0"
The errors that appeared when trying to sync gradle were:
ERROR: Unable to resolve dependency for ':featureModule#flavorDebugFeature/compileClasspath': Could not resolve androidx.annotation:annotation:1.0.0.
ERROR: Unable to resolve dependency for ':featureModule#flavorDebugFeature/compileClasspath': Could not resolve androidx.annotation:annotation:1.0.1.
ERROR: Unable to resolve dependency for ':featureModule#flavorDebugFeature/compileClasspath': Could not resolve androidx.core:core:1.0.0.
ERROR: Unable to resolve dependency for ':featureModule#flavorDebugFeature/compileClasspath': Could not resolve androidx.core:core:1.0.1.
This is repeated for every possible flavour variant combination in this module.
It's worth pointing out that this project was migrated to androidX some months ago and has been working fine.
The fix for the errors are to add the following to the gradle dependencies for that failing module:
implementation "androidx.annotation:annotation:1.0.1"
implementation "androidx.core:core:1.0.1"
The app then compiles fine and runs on device. Perfect. Until we try and run lint in a CI build before release on the project, and we hit a spot of bother, with the error message:
Execution failed for task ':featureModule:lintFlavorDebug'.
> Lint infrastructure error
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
... [several lines omitted for brevity]
Caused by: java.lang.IllegalStateException: Expected task 'processFlavorDebugAndroidTestJavaRes' output files to contain exactly one file, however, it contains no files.
at org.gradle.api.internal.file.AbstractFileCollection.getSingleFile(AbstractFileCollection.java:65)
at com.android.build.gradle.internal.variant.BaseVariantData.getJavaResourcesForUnitTesting(BaseVariantData.java:700)
at com.android.build.gradle.internal.ide.ModelBuilder.createAndroidArtifact(ModelBuilder.java:992)
at com.android.build.gradle.internal.ide.ModelBuilder.createVariant(ModelBuilder.java:617)
at com.android.build.gradle.internal.ide.ModelBuilder.buildAndroidProject(ModelBuilder.java:399)
at com.android.build.gradle.internal.ide.ModelBuilder.buildAll(ModelBuilder.java:212)
at com.android.tools.lint.gradle.LintGradleExecution.createAndroidProject(LintGradleExecution.java:352)
at com.android.tools.lint.gradle.LintGradleExecution.analyze(LintGradleExecution.java:85)
... 59 more
This issue goes away if we remove the 2 new dependencies (plus Google Maps, which seems to be the cause of the requirement for the core and annotations libraries).
I've done some searching both here and via Google, and the Expected task 'processFlavorDebugAndroidTestJavaRes' output files to contain exactly one file, however, it contains no files. exception has been seen by others, and their solution is to make sure the base build.gradle file has the baseFeature true flag in defaultConfig, which is already present in my project.
I'm now stuck for where to go next in trying to solve this issue.

app:transformClassesWithJarMergingForDebug apk build issue

When I try to build apk android studio gives me this error.
Can anyone has any idea about this error?
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: permissions/dispatcher/GrantableRequest.class
If you are using PermissionsDispatcher library thn its mentioned as issue for duplicate class entry.
How to Check attached libraries Dependency/hierarchy ? which causes duplicate entry for libraries.
In your case you need to make changes as per mentioned in libraries known issue.
compile 'com.github.hotchemi:permissionsdispatcher:2.0.3'
compile 'com.github.hotchemi:permissionsdispatcher-processor:2.0.3'
Make changes as per below
compile 'com.github.hotchemi:permissionsdispatcher:2.0.3'
apt 'com.github.hotchemi:permissionsdispatcher-processor:2.0.3'
For more details on duplicate entry issue please check this
UPDATE
Its required to define apt dependecies in root level build.gradle file also
check this for root level build.gradle file declaration.
Let me know if anything

Duplicate Dependency Error At Run Time

I added Parceler Dependency, in build.gradle.
dependencies {
// Parceler
compile 'org.parceler:parceler-api:1.0.4'
apt 'org.parceler:parceler:1.0.4'
}
When i build the project, the project builds successfully but at run time it's throwing the below error.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/parceler/Parceler$$Parcels$1.class
I tried ./gradlew clean command, i did invalidate and restart cache. I also update my android studio to 12.1 preview and gradle to 2.10, but still the same issue.
Any kind of help or suggestions would be appreciated.
It sounds like a duplication of classes between a library (or libraries) and the main project:
http://parceler.org/#avoiding_parcels_indexing
After going through the parceler.org doc, i solved this issue by setting parcelsIndex = false to each of the model classes.
Parceler will not write a Parceler$$Parcels mapping class if no indexable classes exist and the Parcels utiltiy class will fallback to looking up the generated class by name.

Categories

Resources