what happened jar (library ) compile version is different with app compile version? - android

For example
android jar library is compiled with
compile sdk version : 20
target sdk version : 20
And my app
compile sdk version : 21
and target sdk version :21
what happen my app use this jar library.
can it be compiled and executed in android api 21 os?

i have faced this kind of problem once (and there are many question's on SOF) which arise due to difference in version of the lib/*.jar file uses and there project is using, and the build failed because on task was getting failed.
org.gradle.api.tasks.TaskExecutionException: Execution failed for task
':app:transformClassesWithDexBuilderForDebug'.
I am not saying you will get this error for sure but there is a high risk of gradle build failure if the dispute happen's.
Reference:
Question 1
Question 2

Related

Error of react-native-os and gradle versions in react-native project

So I'm using https://www.npmjs.com/package/#walletconnect/react-native-dapp library. The steps is clear I installed npx rn-nodeify --install --hack to have all important libraries for supporting wallet connect. And here is my "postinstall": "./node_modules/.bin/rn-nodeify --install 'crypto,buffer,react-native-randombytes,stream,os' --hack, patch-package". And of course os added react-native-os lib on my package.json too.
Project works perfectly on IOS but I got error running on android. Here is the error
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Where:
Build file '/Users/name/Workspace/projectName/node_modules/react-native-os/android/build.gradle' line: 47
What went wrong:
A problem occurred evaluating project ':react-native-os'.
Could not find method compile() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.ap
and here is the node_modules/react-native-os/android/build.gradle' line: 47 which I got error
46: dependencies {
47: compile 'com.facebook.react:react-native:+'
48: }
So I did a well research and find out that compile function has been deprecated since Gradle 4.10 (Aug 27, 2018), and were finally removed in Gradle 7.0 (Apr 9, 2021).
The aforementioned configurations should be replaced by implementation.
My project's gradle version is 7.2.1. And definitely I can't always go to react-native-os/android/build.gradle file and change the compile word to implementation!! And I can't downgrade my project's gradle version.
I tried to use patch-package lib which let me to modify files in node modules. But after that I see more deprecated stuff and errors. So what can I do?

Generate Signed APK - Error:java: invalid source release: 14

Recently I started with Flutter and made an app, now I am trying to sign the APK for the release version as documented in: https://developer.android.com/studio/publish/app-signing
I have searched a lot on the internet but I have absolutely no clue what I am doing wrong..
When I try to generate the signed APK with my Keystore I am running into an error:
Information:java: Errors occurred while compiling module 'vista_presentie'
Information:javac 1.8.0_242-release was used to compile java sources
Information:Module "vista_presentie" was fully rebuilt due to project configuration/dependencies changes
Information:28-10-2020 19:42 - Build completed with 1 error and 0 warnings in 5 s 852 ms
** Error:java: invalid source release: 14
If I need to give some more information from the code I will update this question as soon as possible, please just ask me :)
Kind Regards,
Kevin
It seems you're using Java 1.8 to compile but in your android studio project you may have set the java language level to 14.
In Android Studio, go to Project Structure -> Modules -> Properties and
set Source Compatibility and Target Compatibility to 1.8 (Java 8)

Using Google Cloud PubSub in Android, find the correct library

Im Using Android Studio 3.0.1, the project uses SDK Version 26. I try to pull messages from Google Cloud PubSub Module using the library 'grpc-pubsub-v1' adding in the app build.gradle the line:
compile ('com.google.api.grpc:grpc-pubsub-v1:0.0.2')
When the gradle sync the next error appear:
Error:Execution failed for task':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Maybe the version of the library is not compatible with the version of SDK, Gradle or other thing, also, adding the line 'multiDexEnabled true' dont fix the problem, the gradle version is 3.0.1.
Which is the correct library to use, or how to find it?
As you are using gradle version is 3.0.1, you need to change compile to implementation as shown in this gradle document. It is a change that was done on the version 3.0.

gradle4.5 compile error: Cannot add task

I use the productFlavors
returns error
Cannot add task ':app:reportSourceSetTransformTest' as a task with that name already exists.
at gradle 4.4 or earlier version doesn't have this problem.
When I updated it to gradle 4.5 yesterday, it returns error, clean project is the same problem. Why?
android studio version:3.2 canary 3
I can't find the reason, I can only lower the Gradle version and the plugin version first. Gradle decreased from 4.6 to 4.4, and plugin decreased from 3.2 to 3.1.4

Compiling android application using Java 8

My application is not yet migrated to gradle, we still use Ant build script.
Recently one of our dependent libraries started using Java 8 features.
In order to compile using Java-8 lib, configured ant script to use java 1.8.
with this change, the compilation is successful, but failing in dex phase.
With 20.x build tools I got
"Bad Class File Magic (cafebabe)" error.
With 24.x build tools I got
"[dex] PARSE ERROR: unsupported class file version 52.0"
Seems to get rid of the dex error, i need to use jack toolchain, however as mentioned earlier, I am not using Gradle builds.
Is there any way to use dex with java-8 code? or Jack tools is the only solution?

Categories

Resources