I add library just like in the docs but have this issue during release build.
What exactly should be excluded?
```ERROR:/root/.gradle/caches/transforms-3/1e96e6c19d7dde614cf9997387c729bf/transformed/jetified-protolite-well-known-types-18.0.0-runtime.jar: R8: Type com.google.protobuf.DescriptorProtos$1 is defined multiple times: /root/.gradle/caches/transforms-3/1e96e6c19d7dde614cf9997387c729bf/transformed/jetified-protolite-well-known-types-18.0.0-runtime.jar:com/google/protobuf/DescriptorProtos$1.class, /opt/bamboo-agent-build-dir/JSM2-JNAD872-BMRA/libpolar/build/.transforms/028706d987454a64deaa47a7849b7551/transformed/jetified-polar-protobuf-release-runtime.jar:com/google/protobuf/DescriptorProtos$1.class
31-May-2022 10:31:19
https://firebase.google.com/docs/perf-mon/get-started-android?authuser=0
Related
Debug version is compiling just fine, however release fails on task app:mergeDexRelease.
I tried so far excluding group in gradle, but without success.
I checked also this Failed to build a React Native signed release but there is no direct answer to how to solve the problem.
I cleaned gradle cache, build folder, removed node_modules and yarn.lock and reinstaled everything
I tried to restart pc
The same error appears for 3 packages: react-native-screens, react-native-safe-area-context, react-native-gesture-handler
Caused by: com.android.tools.r8.internal.a: Type com.facebook.react.viewmanagers.RNGestureHandlerButtonManagerDelegate is defined multiple times: /Users/user/Projects/app/android/app/build/intermediates/project_dex_archive/release/out/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.dex, /Users/user/Projects/app/node_modules/react-native-gesture-handler/android/build/.transforms/8bd7a67ad8066031ac26f199a2fda1a8/transformed/classes/classes.dex
at com.android.tools.r8.internal.tQ.a(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:14)
at com.android.tools.r8.internal.tQ.a(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:22)
at com.android.tools.r8.internal.xK.b(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:7)
at com.android.tools.r8.internal.xK.a(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:23)
at com.android.tools.r8.internal.xK.a(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:10)
at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2048)
at com.android.tools.r8.internal.xK.a(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:6)
at com.android.tools.r8.graph.z2$a.e(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:4)
at com.android.tools.r8.dex.b.a(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:105)
at com.android.tools.r8.dex.b.a(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:28)
at com.android.tools.r8.D8.a(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:26)
at com.android.tools.r8.D8.d(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:593)
at com.android.tools.r8.D8.b(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:1)
at com.android.tools.r8.internal.ci.a(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:24)
... 36 more ```
Answering to myself, the key was to remove
apply plugin: "com.facebook.react"
from app/build gradle.
I also removed react {} block from app/build.gradle.
Can be closed.
As the error indicate, then the class com.facebook.react.viewmanagers.RNGestureHandlerButtonManagerDelegate is defined multiple times. From what I can see it is defined both in the app itself (/Users/user/Projects/app/android/app/build/intermediates/project_dex_archive/release/out/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.dex) and in a module (/Users/user/Projects/app/node_modules/react-native-gesture-handler/android/build/.transforms/8bd7a67ad8066031ac26f199a2fda1a8/transformed/classes/classes.dex). You will have to ensure that there are not two definitions.
The reason this works in debug mode is that the build of the app does not do a full merge of the DEX flies, but just copies in a number of DEX files into the debug APK.
For D8/R8 reference the retrced stacktrace is
Caused by: com.android.tools.r8.utils.AbortException: Type com.facebook.react.viewmanagers.RNGestureHandlerButtonManagerDelegate is defined multiple times: /Users/user/Projects/app/android/app/build/intermediates/project_dex_archive/release/out/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.dex, /Users/user/Projects/app/node_modules/react-native-gesture-handler/android/build/.transforms/8bd7a67ad8066031ac26f199a2fda1a8/transformed/classes/classes.dex
at com.android.tools.r8.utils.Reporter.handleDiagnostic(Reporter.java:81)
at com.android.tools.r8.utils.Reporter.fatalError(Reporter.java:127)
at com.android.tools.r8.utils.ProgramClassCollection.reportDuplicateTypes(ProgramClassCollection.java:74)
at com.android.tools.r8.utils.ProgramClassCollection.lambda$defaultConflictResolver$1(ProgramClassCollection.java:68)
at com.android.tools.r8.utils.ProgramClassCollection.lambda$create$0(ProgramClassCollection.java:28)
at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2048)
at com.android.tools.r8.utils.ProgramClassCollection.create(ProgramClassCollection.java:27)
at com.android.tools.r8.graph.LazyLoadedDexApplication$Builder.build(LazyLoadedDexApplication.java:266)
at com.android.tools.r8.dex.ApplicationReader.read(ApplicationReader.java:184)
at com.android.tools.r8.dex.ApplicationReader.read(ApplicationReader.java:134)
at com.android.tools.r8.dex.ApplicationReader.read(ApplicationReader.java:104)
at com.android.tools.r8.D8.readApp(D8.java:177)
at com.android.tools.r8.D8.run(D8.java:201)
at com.android.tools.r8.D8.lambda$run$1(D8.java:126)
at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:80)
I'm trying to get rid of the Lint warnings in my Android project. Doing so I run into the following type of warning messages that I do not understand:
app\src\main\res\layout-land\event_settings_fragment.xml:25: Error: Class referenced in the layout file, com.google.android.material.textfield.TextInputLayout, was not found in the project or the libraries [MissingRegistered]
<com.google.android.material.textfield.TextInputLayout
^
My app seems to be running fine, so the com.google.android.material.textfield.TextInputLayout class should be available in the project?
Note that I do get this warning on all com.google.android.material.* classes.
MissingRegistered
Summary: Missing registered class
Priority: 8 / 10
Severity: Error
Category: Correctness
NOTE: This issue is disabled by default!
You can enable it by adding --enable MissingRegistered
If a class is referenced in the manifest or in a layout file, it must also
exist in the project (or in one of the libraries included by the project. This
check helps uncover typos in registration names, or attempts to rename or move
classes without updating the manifest file properly.
See: http://tools.android.com/tips/lint-checks
If you ensure that the layout file runs without problems, you can disable the check:
app/build.gradle
android{
lintOptions{
disable "MissingRegistered"
}
}
or add tools:ignore="MissingRegistered" in the layout file to suppress the check.
I've trained a TensorFlow model that among other things performs input preparation involving a tf.cos operation. I've now integrated this model into an Android application, but it cannot perform inference and produces an error No OpKernel was registered to support Op 'Cos' (full error below).
What I've tried:
I've built a selective registration header and made sure that ops_to_register.h contains the Cos operator
I've rebuilt libtensorflow_inference.so as suggested in a related TensorFlow issue while making sure that ops_to_register.h is being used while building the .so file
I placed the new libtensorflow_inference.so file in my app's app/src/main/jniLibs/<architecture> while makings sure that the new .so file is being used by the app
I still get the same error.
Also, not sure if this is related, but cwise_op_cos.cc is missing in tf_op_files.txt and BUILD.
Is there something I'm doing wrong? How do I get the tf.cos operation to work on Android?
Here's the relevant excerpt from the error:
java.lang.IllegalArgumentException: No OpKernel was registered to support Op 'Cos' with these attrs. Registered devices: [CPU], Registered kernels:
<no registered kernels>
[[Node: stft/hann_window/Cos = Cos[T=DT_FLOAT](stft/hann_window/truediv)]]
at org.tensorflow.Session.run(Native Method)
at org.tensorflow.Session.access$100(Session.java:48)
at org.tensorflow.Session$Runner.runHelper(Session.java:298)
at org.tensorflow.Session$Runner.run(Session.java:248)
at org.tensorflow.contrib.android.TensorFlowInferenceInterface.run(TensorFlowInferenceInterface.java:228)
at org.tensorflow.contrib.android.TensorFlowInferenceInterface.run(TensorFlowInferenceInterface.java:197)
at org.tensorflow.contrib.android.TensorFlowInferenceInterface.run(TensorFlowInferenceInterface.java:187)
It turns out that it is indeed necessary to add these commands to the BUILD (tensorflow/core/kernels/BUILD) file manually.
So, for example, to include tf.cos opperation into your libtensorflow_inference.so you need to do the following:
Make sure || isequal(op, "Cos") is in the ops_to_register.h file (see my explanation above)
Add cwise_op_cos.cc to android_extended_ops_group1 filegroup in tensorflow/core/kernels/BUILD
bazel build //tensorflow/contrib/android:libtensorflow_inference.so ... for the right architecture
Later I even found that one of the TensorFlow developers suggested that hacking the BUILD file is the recommended way in this case :/
Android only builds a subset of the ops, You need to add the ops that
you need that are not in the "commonly used set" by hacking the build
files for your needs.
Source: https://github.com/tensorflow/tensorflow/issues/11804#issuecomment-318415228
After adding a library to project that contains native code (embedded as .so), my app build started to crash when running the dexguard<Flavor><BuildType> task.
The error says:
Caused by: java.io.IOException: Can't read [/home/user/project/app/build/intermediates/transforms/mergeJniLibs/flavor/buildType/folders/2000/1f/main(;;;;;;lib/*/*.so,lib/*/gdb*)] (Can't write resource [lib/x86/filecointainedonlibrary.so] (New string section exceeds the length of the original: 243 > 242))
That might happen when DexGuard obfuscates your native methods.
The latest version 7.1.29 should fix this issue, please give it a try.
Edit: The troubleshooting section of the DexGuard manual describes work-arounds when this happens. They basically keep names of native methods.
I am not sure if it is Android Studio ( 0.1.9 ) or AndroidAnnotation problem, however, lately I cannot make and compile my AndroidAnnotations projects.
Ok, so I try to make project and this is what I got in "Messages" window:
Information:Round 1:
Information: input files: {com.antyzero.sidereelo.ui.activity.SplashActivity}
Information: annotations: [com.googlecode.androidannotations.annotations.EActivity, java.lang.Override]
Information: last round: false
Information:Processor com.googlecode.androidannotations.AndroidAnnotationProcessor matches [com.googlecode.androidannotations.annotations.EActivity] and returns true.
Information:Note: Starting AndroidAnnotations annotation processing
Information:Round 2:
Information: input files: {com.antyzero.sidereelo.ui.activity.SplashActivity_}
Information: annotations: [java.lang.Override]
Information:Processor com.googlecode.androidannotations.AndroidAnnotationProcessor matches [] and returns true.
Information:Round 3:
Information: input files: {}
Information: annotations: []
Information: last round: true
Information:Compilation completed successfully with 1 warning in 17 sec
Information:0 errors
Information:1 warning
Warning:: Unclosed files for the types '[dummy1372862415557]'; these types will not undergo annotation processing
Nothing less, nothing more. In result I don't have my SplashActivity_ created. This message is from brand new project but my old projects are also affected.
Answer from Android Studio: Use AndroidAnnotations is not helpful.
I was working with AA and IntelliJ weeks before Android Studio without problem. IMO it might happen after latest Android Studio update, but maybe there is some kind of solution for this right now, if not I will report this to Android Studio team. Thanks for help.
One more thing. My projects are using Maven and building them from CLI works fine, all classes are generated as they should be.
I was facing the same problem when trying to inject a view with #ViewById, and the problem was that I was declaring the field private. Declaring it at least protected fixed the issue!
Before:
#ViewById
private NoListResultsView noResultsView;
After
#ViewById
protected NoListResultsView noResultsView;