React Native: Deprecated Gradle features ..., making it incompatible with Gradle 7.0 - reactjs

I'm getting this error. It all started when I tried to make use of react-native-camera and run my project
> Task :react-native-camera:compileGeneralDebugJavaWithJavac
> Task :app:mergeDexDebug FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
252 actionable tasks: 33 executed, 219 up-to-date
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\joans\Desktop\Project\new_project\node_modules\react-native-camera\android\src\main\java\com\google\android\cameraview\Camera2.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
D8: Cannot fit requested classes in a single dex file (# methods: 65711 > 65536 ; # fields: 71075 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
.....
* What went wrong:
Execution failed for task ':app:mergeDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
Please, any suggestions would be helpful

Related

How to make app compatible with Android 12 (Snow Cone)

I am trying to build my Ionic App to support Android 12. It works fine upto Android 11, but is not supporting Android 12.
==Supported credentials to Android 11==
package.json
“cordova-android”: “^9.1.0”
build.gradle file:
defaultBuildToolsVersion=“29.0.2”
defaultMinSdkVersion=22
defaultTargetSdkVersion=30
defaultCompileSdkVersion=30
config.xml file:
preference name="android-targetSdkVersion" value="30"
==Tried increasing sdk to 31==
package.json file:
“cordova-android”: “^10.0.0”
build.gradle file:
defaultTargetSdkVersion=31
defaultCompileSdkVersion=31
config.xml file:
preference name="android-targetSdkVersion" value="31"
added android:exported=“true” in MainActivity in ..\platforms\android\app\src\main\AndroidManifest.xml
Error :
FCMPlugin: Support for Gradle v4 or lower is deprecated. Please upgrade to a newer version.WARNING:: Configuration ‘compile’ is obsolete and has been replaced with ‘implementation’ and ‘api’.
It will be removed in version 7.0 of the Android Gradle plugin.
For more information, see Add build dependencies | Android Developers.
WARNING:: Using flatDir should be avoided because it doesn’t support any meta-data formats.
Task :app:processDebugMainManifest FAILED
…\platforms\android\app\src\main\AndroidManifest.xml Error:
Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See <activity> | Android Developers for details.
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ‘:app:processDebugMainManifest’.
Manifest merger failed : Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See <activity> | Android Developers 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use ‘–warning-mode all’ to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See Command-Line Interface
BUILD FAILED in 3s
15 actionable tasks: 1 executed, 14 up-to-date
Command failed with exit code 1: …\platforms\android\gradlew cdvBuildDebug -b …\platforms\android\build.gradle
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
I have tried all forums and posts, nothing seem to works. Anybody has an idea on how to make this work?

Error on compile to Andriod when apply certificate

My app compile for android ok.
When I create the android certificate, and send to the codename compiler it don´t compile.
I tried to generate the certificate with the keytool and tried with the assitant on codenameone, the result is similar.
If I delete the keystore file and resend to the dashboard, the app compile ok.
This is the log errors
Note: there were 3 references to unknown classes.
You should check your configuration for typos.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
Note: there were 1 references to unknown class members.
You should check your configuration for typos.
Note: there were 22 unkept descriptor classes in kept class members.
You should consider explicitly keeping the mentioned classes
(using '-keep').
(http://proguard.sourceforge.net/manual/troubleshooting.html#descriptorclass)
Note: there were 17 unresolved dynamic references to classes or interfaces.
You should check if you need to specify additional program jars.
(http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
Note: there were 5 class casts of dynamically created class instances.
You might consider explicitly keeping the mentioned classes and/or
their implementations (using '-keep').
(http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclasscast)
Warning: there were 25 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning: there were 2 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile the code.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
Warning: Exception while processing task java.io.IOException: Please correct the above warnings
first.
:transformClassesAndResourcesWithProguardForRelease FAILED
:transformClassesAndResourcesWithProguardForRelease (Thread[Task worker for ':',5,main]) completed. Took 3.21 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformClassesAndResourcesWithProguardForRelease'.
> Job failed, see logs for details
* Try:
Run with --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task
':transformClassesAndResourcesWithProguardForRelease'.
at
This has nothing to do with the certificate. It fails in the obfuscation stage before the certificate. These errors are notoriously hard to read and it seems you snipped it a bit too late. I need the section above that which includes the detailed warning about the class/method that isn't found.
Go to the error and scroll a bit higher and look for a familiar class name with a proguard warning next to it. This is the class causing a problem probably because of a missing dependency. If you can't find it just post the log link to the website chat and our support will look over that for you.

How to fix CodenameOne build upload error

I have been running into some issues when trying to submit a build to the server. Every time I try to submit it, it fails. Here's the output of the process :
ant -f /home/darklord/NetBeansProjects/DashboardFAES build-for-android-device
No GUI Entries available
init:
deps-clean:
Updating property file: /home/darklord/NetBeansProjects/DashboardFAES/build/built-clean.properties
Deleting directory /home/darklord/NetBeansProjects/DashboardFAES/build
refresh-libs:
Deleting directory /home/darklord/NetBeansProjects/DashboardFAES/lib/impl
clean:
copy-android-override:
Created dir: /home/darklord/NetBeansProjects/DashboardFAES/build/classes
copy-libs:
deps-jar:
Updating property file: /home/darklord/NetBeansProjects/DashboardFAES/build/built-jar.properties
Compile is forcing compliance to the supported API's/features for maximum device compatibility. This allows smaller
code size and wider device support
Created dir: /home/darklord/NetBeansProjects/DashboardFAES/build/tmp
Compiling 13 source files to /home/darklord/NetBeansProjects/DashboardFAES/build/tmp
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.
Created dir: /home/darklord/NetBeansProjects/DashboardFAES/build/empty
Created dir: /home/darklord/NetBeansProjects/DashboardFAES/build/generated-sources/ap-source-output
Compiling 13 source files to /home/darklord/NetBeansProjects/DashboardFAES/build/classes
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.
Copying 1 file to /home/darklord/NetBeansProjects/DashboardFAES/build/classes
Copied 2 empty directories to 2 empty directories under /home/darklord/NetBeansProjects/DashboardFAES/build/classes
compile:
Created dir: /home/darklord/NetBeansProjects/DashboardFAES/dist
Copying 1 file to /home/darklord/NetBeansProjects/DashboardFAES/build
Not copying library /home/darklord/NetBeansProjects/DashboardFAES/override , it's a directory.
Not copying library /home/darklord/NetBeansProjects/DashboardFAES/lib/impl/cls , it's a directory.
Not copying library /home/darklord/NetBeansProjects/DashboardFAES/lib/impl/stubs , it's a directory.
Not copying library /home/darklord/NetBeansProjects/DashboardFAES/native/internal_tmp , it's a directory.
Copy libraries to /home/darklord/NetBeansProjects/DashboardFAES/dist/lib.
Building jar: /home/darklord/NetBeansProjects/DashboardFAES/dist/DashboardFAES.jar
To run this application from the command line without Ant, try:
java -jar "/home/darklord/NetBeansProjects/DashboardFAES/dist/DashboardFAES.jar"
jar:
clean-override:
build-for-android-device:
You sent an android build without submitting a keystore. Notice that you will receive a build that is inappropriate for distribution (although it could be used for debugging purposes). For further details read http://www.codenameone.com/signing.html
Sending build request to the server, notice that the build might take a while to complete!
Sending build to account: mysuperaddress#gmail.com
Response message from server is: OK
Server provided no further details
java.io.IOException: An upload error occured - check that you have enough build credits on the server
at com.codename1.build.client.BuildProcess.sendS3Build(BuildProcess.java:410)
at com.codename1.build.client.BuildProcess.sendRequestToServer(BuildProcess.java:432)
at com.codename1.build.client.CodeNameOneBuildTask.execute(CodeNameOneBuildTask.java:436)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
/home/darklord/NetBeansProjects/DashboardFAES/build.xml:300: Error in server build process
BUILD FAILED (total time: 1 minute 55 seconds)
Please help me out !
In 9 times out of 10 it means you ran out of build credits for this month which are reset every month. Notice that you can see those in the subscription tab.
In 9 times out of the remainder this is due to a bad connection/proxy configuration. You need to configure the Java proxy as well as the main process.
In the last 1 percent of the cases something might have went wrong in which case I suggest contacting us via one of our support channels.

Codename One Facebook/Android

Android build fails when I include the build hint "facebook.appId". iOS build works fine. Excerpt from the Android build log (I hope this is the relevant bit):
Merged dex A (41 defs/6.4KiB) with dex B (43 defs/53.5KiB). Result is
84 defs/71.7KiB. Took 0.2s Dex: Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define
Lbolts/AggregateException;
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lbolts/AggregateException;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
:transformClassesWithDexForRelease FAILED :transformClassesWithDexForRelease (Thread[Daemon worker,5,main])
completed. Took 2 mins 55.612 secs.
FAILURE: Build failed with an exception.
Any suggestions, anyone?
There is a conflict with the bolt jar facebook is including it and parse4cn1 is also including it.
Try to remove it by building the parse4cn1 without the bolts-android-1.2.1.jar file that is under the parse4cn1/native/android/ directory
Do you have leadbolts enabled in your project?
It looks like a conflict between leadbolts and facebook. Also try building with android.gradle=false and see if that works around the issue.

m2eclipse - Mystery Build Failure on Package

I am using Eclipse 3.6 (Helios64) and m2eclipse 0.12.1.20110112-1712. I have a new project that only contains two classes that builds a jar. When I right click the project and select "Run As -> Maven package", I get the following error:
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # switch-provisioning-rest-client --- [INFO] Compiling 2 source files to C:\Devel\EclipseProjects\MyProject\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Failure executing javac, but could not parse the error:
javac: invalid flag: -s
...
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
When I set up a run configuration with the Goals "package -X", the project builds without error. If I run a configuration with the goal set to compile, it builds without error and I can then run "Maven package" successfully.
This is the only project I'm having issues with. All my other projects build sucessfully when doing a "Maven package".
There's nothing exceptional about the project pom.xml. It refers to the same parent pom as the other projects and contains its project specific dependencies.
Has anybody got any ideas what could be different about this project?
TIA!
This issue was answered on the m2eclipse mailing list:
http://dev.eclipse.org/mhonarc/lists/m2e-users/msg01818.html
Although my pom had 1.6 as the version, the project configuration hadn't been updated.
From: Benjamin Bentmann
This issue is not really specific to m2e but applies to mvn in general, as such the Maven user list might provide a better audience for help.
IIRC, the specific error means you trying to use a JDK 1.5 while you need JDK 1.6+ where the javac option in question was added. Assuming your project should actually compile against JDK 1.5, downgrading the maven-compiler-plugin version might also do, I would expect it started to use the -s option when the annotation processing support was added.

Resources