Cordova Android app force closes after build - android

Here's the error details:
12-04 22:00:12.087: E/AndroidRuntime(19113):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.package.name.dev/com.package.name.dev.MainActivity}:
java.lang.NullPointerException: Attempt to invoke virtual method 'void
org.apache.cordova.CordovaPlugin.privateInitialize(java.lang.String,
org.apache.cordova.CordovaInterface,
org.apache.cordova.CordovaWebView,
org.apache.cordova.CordovaPreferences)' on a null object reference
Background: I was originally only building the app for Android, but during my last release I had to generate an iOS build as well, which required some extra plugins and configuration tweaks to get functional. Now I'm trying to create a new release for Android, but the new app force closes as soon as it is opened.
In an effort to fix it, I tried to remove all references to the iOS-only plugins from the Android side of the project, but the error persists. I'm not sure what else to try.
What would provoke Cordova to throw this error when initializing plugins?

The issue was that one of the plugins had failed to copy its java classes into the Android app src directory when it was installed. I created the appropriate directory hierarchy and then copied in the java files from the /plugins/ dir.
To figure out which plugin caused the issue, I disabled the onload param from each feature one at a time (in the android.json file in the android platform directory) until the app successfully opened.

Related

EAS Build (Android) .apk Crashes, Expo Build .apk Runs Correctly

I'm updating a React Native app to EAS Build, after using expo build for several years. The app works via the development server.
After running eas build, the .apk file builds successfully, but immediately crashes when opened on a device.
My error log is:
TypeError: undefined is not an object (evaluating 't.indexOf')
Running "main" with {"rootTag":1}
Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.
Has anyone run into this error?
I also had problems, but after reading the documentation some things changed.
Are you migrating an Expo managed app from "expo build"? Learn about the differences.
They must create an index file (reference), with:
import { registerRootComponent } from 'expo';
import App from './src/App';
registerRootComponent(App);
(If the App.js is in the root, delete the /src so they have ./App)
And then, from the package.json, delete the entire line of main.
And [this is the most difficult step]
(https://docs.expo.dev/build-reference/migrating/#metroconfigjs--must-export-the-entire-default
, it cost me
i have the same problem
Invariant Violation: "main" has not been registered. This can happen if:
Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
A module failed to load due to an error and AppRegistry.registerComponent wasn't called.

How to use "mapping.txt" file for debug and error-exception handler for Release version in Android

I want to upload errors to the user in the app to the database server, but in the Release version, because it's used with Proguard, it does not correctly represent the classes that have encountered the error, as in the example Has been laid.
Sample error message
Attempt to write to field 'java.lang.String com.employe.school.Application.Message.c.c' on
a null object reference
Instead of "c.c", your actual class name will be displayed.
In general, I want to handle the App errors myself and do not use Firebase or other crash reporters.
Is there a way to solve this problem?
%SDK_DIR%\tools\proguard\bin\retrace mapping.txt errors.txt > fixed.txt
Do the work.
Android studio create mapping(build/outputs/mapping/release/mapping.txt) file under release folder for Release builds. You can use them to find out where the error is occured. Re-mapping is already implemented on Google Play Console and crashlytics. You just put mapping file with corresponding APK to play console and errors are shown correctly.

Unable to install the fabric plugin (for crashlytics) on Android Studio

Unable to download the Fabric plugin on Android studio. I am able to download other plugins on the same network, so not an issue with the connectivity.
As an alternative, i tried manual installation of the plugin. But with manual installation, the plugin somehow does not launch (ends with an exception).
So I am back to this. Is anyone else facing this issue ?
P.S - I am on Android Studio 2.2.2
P.S - Below is the crash log when i install the plugin manually and restart Android Studio (Some part of the crash stack removed for brevity)
Plugin 'com.crashlytics.tools.androidstudio' failed to initialize and will be disabled. Please restart Android Studio.
java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of com/intellij/ide/plugins/cl/PluginClassLoader) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of com/intellij/util/lang/UrlClassLoader) for the method's defining class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:299)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281)
at com.crashlytics.tools.bootstrap.osgi.OsgiBootstrapper.<clinit>(OsgiBootstrapper.java:54)
at com.crashlytics.tools.intellij.CrashlyticsPlugin.initComponent(CrashlyticsPlugin.java:89)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:522)
at

java.lang.UnsatisfiedLinkError: Couldn't load stlport_shared: findLibrary returned null

I am working with CsipSimple and try to create an account in local network...the build runs fine....but i can't make my account active....at the beginning of the project run it catches an exception java.lang.UnsatisfiedLinkError.......and it says unable to load native library...I have been searching all day long...i created armeabi-v7a under lib folder....and I have downloaded two .so file from firefox nightly build as descripted in this link.... here but i have same problem....please help me with this
Thrown when an attempt is made to invoke a native for which an implementation could not be found.
http://developer.android.com/reference/java/lang/UnsatisfiedLinkError.html
Please check this link https://stackoverflow.com/a/22121375/1761003
Please do post some code for better reply

Unsatisfied link error for native library

I developed applications which use native code. All of a sudden those are not working, giving error "Unsatisfied link error: Couldn't load native library from loader dalvik.System.pathClassLoader, findLibrary returned null. I restarted adt twice. Still getting the same error. Applications which are not using native code, are working fine.
The error implies that the program is not able to find the shared libraries that you would have created.
Which devices did you try it on ?
You can check once if they are available in libs directory of your app . [/data/data/app_id/lib ]. Also check if armv7 support is required and if the directory is there in the libs , is .so present there.
Now it's working. I deleted all my virtual devices and then created a new one. However it's showing "skipped 264 frames. application may be doing too much work on main thread" many times and whenever we press a button, displaying this message in log "error loading /system/media/audio/ui/Effect_Tick.ogg"
thanks.

Categories

Resources