Genrate Apk from React Native app , JDK Error - android

here is the error while building the signed apk
the following screenshot is the packages and version used within the app.
> Task :react-native-firebase_messaging:compileReleaseJavaWithJavac FAILED
An exception has occurred in the compiler (1.8.0_291). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.tools.javac.util.UnsharedNameTable$NameImpl)

for solving this issue , you should update your jdk and also keep your firebase libraries updated .
then run ./gradlew clean within Project's root and remove the build folder within app.
it should solve the issue!

Related

Android Room + Kotlin + Kapt + IntelliJ + MacOS Catalina: java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open_utf8

Using Android Room with Kapt on MacOS Catalina, I get the following errors building the project. The project builds successfully if I remove kapt "androidx.room:room-compiler:$room_version" from my build.gradle.
Failed to load native library:sqlite-3.25.2-60e239c7-424b-4b75-bfd5-b2df4aa8e01a-libsqlitejdbc.jnilib. osinfo: Mac/x86_64
java.lang.UnsatisfiedLinkError: $TMPDIR/sqlite-3.25.2-60e239c7-424b-4b75-bfd5-b2df4aa8e01a-libsqlitejdbc.jnilib: dlopen($TMPDIR/sqlite-3.25.2-60e239c7-424b-4b75-bfd5-b2df4aa8e01a-libsqlitejdbc.jnilib, 1): no suitable image found. Did find:
$TMPDIR/sqlite-3.25.2-60e239c7-424b-4b75-bfd5-b2df4aa8e01a-libsqlitejdbc.jnilib: code signature in ($TMPDIR/sqlite-3.25.2-60e239c7-424b-4b75-bfd5-b2df4aa8e01a-libsqlitejdbc.jnilib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
Failed to load native library:sqlite-3.25.2-79b61bc4-bdd0-4451-a523-5baa49728398-libsqlitejdbc.jnilib. osinfo: Mac/x86_64
java.lang.UnsatisfiedLinkError: $TMPDIR/sqlite-3.25.2-79b61bc4-bdd0-4451-a523-5baa49728398-libsqlitejdbc.jnilib: dlopen($TMPDIR/sqlite-3.25.2-79b61bc4-bdd0-4451-a523-5baa49728398-libsqlitejdbc.jnilib, 1): no suitable image found. Did find:
$TMPDIR/sqlite-3.25.2-79b61bc4-bdd0-4451-a523-5baa49728398-libsqlitejdbc.jnilib: code signature in ($TMPDIR/sqlite-3.25.2-79b61bc4-bdd0-4451-a523-5baa49728398-libsqlitejdbc.jnilib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
Which produces the following exception
Caused by: java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open_utf8([BI)V
at org.sqlite.core.NativeDB._open_utf8(Native Method)
at org.sqlite.core.NativeDB._open(NativeDB.java:78)
at org.sqlite.core.DB.open(DB.java:195)
at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:243)
at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:61)
at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:28)
at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:21)
at org.sqlite.JDBC.createConnection(JDBC.java:116)
at androidx.room.verifier.DatabaseVerifier$Companion.create(DatabaseVerifier.kt:104)
at androidx.room.processor.DatabaseProcessor.doProcess(DatabaseProcessor.kt:82)
at androidx.room.processor.DatabaseProcessor.process(DatabaseProcessor.kt:57)
at androidx.room.RoomProcessor$DatabaseProcessingStep.process(RoomProcessor.kt:134)
at com.google.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:330)
at com.google.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:181)
at org.jetbrains.kotlin.kapt3.base.incremental.IncrementalProcessor.process(incrementalProcessors.kt)
at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.process(annotationProcessing.kt:147)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:985)
... 39 more
It looks like this is different from https://github.com/xerial/sqlite-jdbc/issues/97, which is the only issue I could find any information about. Is there any way to work around this issue?
Edit:
I ended up finding this blog post, which led me to this JDK issue. I verified that ./gradlew :app:kaptDebugKotlin worked with my JDK11, and updated IDEA to use that JDK as it's runtime, as well as telling it to execute builds with gradle instead of IDEA. Neither of those seemed to fix the issue - running ./gradlew clean :app:kaptDebugKotlin in my terminal with JDK11 succeeded, but running that gradle task through IDEA failed.
I ended up working around it by removing gradle-aware make from my run configuration, and running ./gradlew :app:assembleDebug every time I make changes to the app. It's a little annoying and adds an extra step, but I can still run/update the app.
Figured it out - it turns out the Gradle setting for Java SDK is ignored in Android projects, and instead the Java SDK from the Android SDK is used for gradle tasks. Setting the Android SDK's Java SDK to JDK11 fixed the issue, because that JDK has the fix for JDK-8223671

Flutter Build Apk Error "Unresolved reference: snackbar"

I'm currently making an e-commerce project using flutter. I need a payment gateway to make transactions, so I install the "stripe_payment" package (https://pub.dev/packages/stripe_payment).
After I followed the installation steps, I run the "flutter run" command. The result is the package stripe can run well in my application.
However, when I run the "flutter build apk", an error appears as below:
The main errors are:
e: C:\Users\samue\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\stripe_payment-1.0.5\android\src\main\kotlin\de\jonasbark\stripepayment\StripeDialog.kt: (6, 36): Unresolved reference: snackbar
When I open the C:\Users\samue\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\stripe_payment-1.0.5\android\src\main\kotlin\de\jonasbark\stripepayment\StripeDialog.kt file and I check line 6, I see inside the file importing import com.google.android.material.snackbar.Snackbar.
Then I looked for a solution on google, it looks like the problem is build.gradle. Here I attach the contents of the file from build.gradle
But I tried editing the build.gradle dependencies section that I got from Google, but all of them didn't work. When I run the flutter build apk, the same error still appears.
I have found the solution. I deleted the package "search_widget", then the package "stripe_payment" can run normally again without any errors during the build.
From this problem, I just understood that there are possibilities that packages on flutter can conflict, causing errors.

Gradle Build : error package does not exist

I was developing an android app (using Eclipse, not Studio) following some example, which makes use of Github/CircleImageView. Hence, I wanted to compile that first into a jar library.
So on my Linux machine I installed gradle and since its my first time with gradle, I followed the tutorial on gradle. So, in the root directory of the project ~/Downloads/CircleImageView-master/, I :
Run gradle wrapper. Got Build Success
Run ./gradlew build, gives the following error
CircleImageView.java:21: error: package com.nineoldandroids.animation does not exist
import com.nineoldandroids.animation.ObjectAnimator;
Though, I can see that there is one jar file in the project ~/Downloads/CircleImageView-master/circleimageview/libs/nineoldandroid-library-2.4.0.jar. Can anyone please help in resolving the issue. I am trying since past 10 hours and reached so far here after resolving all the issues, and stuck just at the last point.
I opened the jar in a package manager and the required classes are there, including ObjectAnimator.

Please build project before executing SonarQube and check the location of compiled classes

I am executing sonar-runner on my Android project, and get this error:
Android Lint needs sources to be compiled. Please build project before executing SonarQube and check the location of compiled classes.
My project is already built, classes are in bin/classes.
How to solve this?
My sonar-project.properties:
sonar.projectKey=anki:AnkiDroid
sonar.projectName=AnkiDroid
sonar.projectVersion=1.0
sonar.sources=src
sonar.language=java
sonar.sourceEncoding=UTF-8
sonar.profile=Android Lint
Add this line to your sonar-project.properties:
sonar.binaries=bin/classes
It solves the problem.

Errors running builder 'CDT Builder' when trying to build OpenCV for android samples

Hello guys I'm trying to learn about openCV in android
I've already following the instruction given here
but when I'm trying to compile I'm only getting
01:50:14 ** Auto Build of configuration Default for project
org.opencv.samples.fd.FdActivity **
"C:\Android\android-ndk-r8\ndk-build.cmd" Install:
libdetection_based_tracker.so =>
libs/armeabi-v7a/libdetection_based_tracker.so
01:50:14 Build Finished (took 184ms)
in the console
and I'm also get an error
Errors occurred during the build. Errors running builder 'CDT Builder'
on project 'org.opencv.samples.fd.FdActivity'. Internal error building
project org.opencv.samples.fd.FdActivity configuration Default
java.lang.NullPointerException Internal error building project
org.opencv.samples.fd.FdActivity configuration Default
java.lang.NullPointerException
anyone ever encountered this problem before?
please help me to solve this problem
thank you
try
Project Properties>C/C++ Build>Tool Chain Editor
Current toolchain: Android GCC
Current builder: Android Builder
Project Properties>C/C++ Build
(uncheck) use default build command
Build command: ndk-build
(uncheck) generate Makefiles automatically
You may have renamed the project, and the eclipse forgot to rename the "Refresh Policy".
Just update "Project properties -> C/C++ Build -> Refresh Policy" manually solved my problem.
BTW, ADT has some very bad error descriptions as of in this case.
I might have the same problem,
try ndk-build -B which rebuild all the things, see whether you still got error,
if no error remain, there is no problem with your ndk-build. try to run your android apps without CDT installed, if this works, at least we could use comand line to build the c++ part of code.
but CDT is still not working well, after I install the CDT according to the opencv doc, I got lots of errors, add the cygwin and gcc things to the path would solved most of it. But the last things every strange is, I got an error here.
in the face detection sample, .cpp part
catch(cv::Exception e)
{
LOGD("nativeCreateObject catched cv::Exception: %s", e.what());
it always says symbol "e" can not be resolved.
but no error when I include the opencv things.
even when I try to put cv::Exception e outside of the catch()
These works for me:
Build command: ndk-build
(uncheck) generate Makefiles automatically

Categories

Resources