React Native Android app white screen won't start - android

I get the following error log when I run my Android app: http://pastebin.com/1jHEfdQ3 The app sometimes crashes in the simulator but most of the time it just displays a white screen. I can console.log one or two things until the app won't respond. R-R to refresh doesn't work. None of the dev tools work. I'm stumped with what to do at this point.
I'm running react native 0.38.0
EDIT:
I've tried cleaning my gradle and deleting and reinstalling my node modules.
One thing to note is that I am using React Native Navigation which means I had to modify MainApplication and MainActivity to the following:
MainActivity:
package com.prayerrequest;
import com.facebook.react.ReactActivity;
import com.reactnativenavigation.NavigationApplication;
import com.airbnb.android.react.maps.MapsPackage;
import com.cmcewen.blurview.BlurViewPackage;
import io.realm.react.RealmReactPackage;
import com.reactnativenavigation.controllers.SplashActivity;
public class MainActivity extends SplashActivity {
}
MainApplication:
package com.prayerrequest;
import com.facebook.react.ReactPackage;
import com.cmcewen.blurview.BlurViewPackage;
import io.realm.react.RealmReactPackage;
import com.airbnb.android.react.maps.MapsPackage;
import com.reactnativenavigation.NavigationApplication;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends NavigationApplication {
#Override
public boolean isDebug() {
// Make sure you are using BuildConfig from your own application
return BuildConfig.DEBUG;
}
#Override
public List<ReactPackage> createAdditionalReactPackages() {
return Arrays.<ReactPackage>asList(
new RealmReactPackage(),
new BlurViewPackage(),
new MapsPackage()
);
}
}
I've crossposted on React Native's issues page here

The issue seems to be 'Couldn't load memtrack module (No such file or directory)'
It looks like there's an issue with the simulator.
This is a config of my fully functional simulator:
Lots of other suggestions can be found here:
Couldn't load memtrack module Logcat Error

I had a similar problem. I would get this white screen when trying to get it to run on device.
The problem was when I would do adb devices or react-native run-android I would get "ADB is Not Recognized as an internal or external command".
So my fix was to add the path to adb.exe's parent directory to my Environment Variables and then restart my command prompts.I then ran react-native run-android and on startup no more red screen showing the completely useless error message Error calling AppRegistry.runApplication! :)
So I found ADB was located in my folder:
C:\Users\dell\AppData\Local\Android\sdk\platform-tools\adb.exe
I am on a Windows 10 system. dell is my user name of the computer.
So I went to System Environment Variables then found "Path" then clicked "Edit", then clicked "New" and added in "C:\Users\dell\AppData\Local\Android\sdk\platform-tools".

Related

FlashDevelop error creating APK for simple project

Apk cannot be build because of errors, some obvious troubleshooting doesnt fix it
I start an AIR Mobile AS3 App project. Finally I can say it correctly found its AIR and Flex folders. There have been threads about such issues but not with latest versions of Flex and mostly with AIR. So a new project with latest flex and AIR, I installed the AppMan package Flex SDK + AIR SDK 4.6.0. + 32.0.0
Obvious paths in the SetupSDK.bat are:
..(whatever drive)\FlashDevelop-5.3.3\Apps\flexairsdk\4.6.0+32.0.0
..(whatever drive)\FlashDevelop-5.3.3\Tools\android (that includes platform-tools containing adb.exe)
… and so application.xml must have ?
application xmlns="http://ns.adobe.com/air/application/32.0"
defaults in 28.0 but that changes nothing
Yes certificate is created from the bat
And that's it, a simple embedded image display:
I have to switch between Debug and Release when pressing F5 because repeating twice Debug or Repeat causes the error that var value for image is empty, but if you alternate it displays image in Device window so i will assume it compiles well.
Or deleting the project.swf generated on compilation also allows to display the image if running Debug or Release for first time.
But t he error is when running the PackageApp.bat and [1] for normal apk
http://www.flashdevelop.org/community/viewtopic.php?f=6&t=12144
This solved the issue. I had to install JRE 1.6 too since 1.8 has bugs with FD. set the path for java.home in jvm.config to use the JRE 1.6 folder, no more 'Variable not defined', it was common message, and now I can F5 without the error, thanks for the above tips for Bitmap still.
Regarding your code at: http://oneclickpaste.com/26534/
In Main.as try to close the import with a ; (just in case it's giving a weird technical issue).
example: import com.mee.ptest.PicTest;
In PicTest.as you need to fix this line: iPic = new PicTest.cTestPic();
To become as: iPic = new cTestPic() as Bitmap;.
Example for PicTest.as:
package com.mee.ptest
{
import flash.display.Bitmap;
import flash.display.Sprite;
public class PicTest extends Sprite
{
[Embed(source="../../../assets/testpic.jpg")]
private static var cTestPic :Class;
private var iPic :Bitmap;
public function PicTest()
{
iPic = new cTestPic() as Bitmap;
addChild(iPic);
}
}
}
And then example for Main.as:
import flash.desktop.NativeApplication;
import flash.events.Event;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
import flash.display.Bitmap;
import flash.display.*;
import com.mee.ptest.PicTest;
public class Main extends Sprite
{
public var pic : PicTest;
public function Main()
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.DEACTIVATE, deactivate);
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
//# check if app is ready to display visual items...
if (stage) { show_Pic(); }
else { addEventListener( Event.ADDED_TO_STAGE, show_Pic ); }
}
private function show_Pic() :void
{
pic = new PicTest();
addChild(pic);
}
private function deactivate(e:Event) :void
{
// make sure the app behaves well (or exits) when in background
//NativeApplication.nativeApplication.exit();
}
}

All android project file encoded wrongly

All my android studio file is not showing original code. All java and XML file affected. When I open a file it shows "File was loaded in the wrong encoding:'UTF-8'. I tried to reload in another coding but problem not resolved. I can see code in Notepad but not in android studio.
CustomApplication.java Original Code showing in Notepad
package satlaa.desijewellery.utils;
import android.app.Application;
import android.content.Context;
import android.content.res.Configuration;
public class CustomApplication extends Application {
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(LocaleHelper.onAttach(base, "hi"));
}
}
In Android Studio
AAPT , �
&layout/abc_alert_dialog_title_material
"�C:\Users\Anjaan\.gradle\caches\transforms-1\files-1.1\appcompat-v7-
27.1.1.aar\11bca4c6723b60847116b8b51872d16b\res\layout\abc_alert_dialog_title_m
aterial.xml*
id/alertTitle-*
id/titleDividerNoCustom8*
id/title_template*
id/topPanel
�
9
android*http
I can even set here as code.
Go to :
File -> Other Settings -> Default Settings, find File Encodings, change Project Encoding to System-Default and the other settings as follows:
If this didn't help, try reinstalling the Android Studio (or install the latest version if you already don't use it).

React Native Sqlite for android configuration

I am playing with react native for android and i have special interest with sqlite.
I try to use the sqlite lib here react-native-sqlite-storage buy i always have BUILD FAILED when "run-android". I'm a little lost at step 4 (How to use Android)
configuring the MainActivity
The error:
E:\Documents\Visual Studio CODE\MyApp\android\app\src\main\java\com\myapp\MainActivity.java:22: error: cannot find symbol
protected List getPackages() {
^
symbol: class List
location: class MainActivity
...
Have somebody a very simple sample project for android to see the correct conf?
thanks in advance.
You are missing import statement for the List.
import java.util.List;
#Override
protected List getPackages() {
//noinspection RedundantArrayCreation
return Arrays.asList(new ReactPackage[]{
new MainReactPackage(),
});
}
Any java IDE has some kind of fix import function so it would automatically propose you correct solution.
Try android studio it's free and react-native automatically generate gradle configuration. All you need to do is to import your project folder with gradle files (android by default) into IDE and press ctrl+space to turn IntelliSense on.
You should change MainAplication.java and not MainActivity.java

Android sensor manager-react native error

I need to access accelerometer in my react native app. Apparently the only one for Android is this one and it does not work. Ive even tried it on a separate clean project and still shows undefined is not an object (evaluating mSensorManager.startAccelerometer). I'm using the sample code provided in readme, What am I doing wrong?
PS: I'm using an actual device, not a VM.
The problem is solved here. I added to MainActivity.java following code:
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.sensormanager.SensorManagerPackage;
import java.util.Arrays;
import java.util.List;
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new SensorManagerPackage()
);
}
Make sure to follow the steps in the README file.
after you do the npm i react-native-sensor-manager --save ,
instead of doing rnpm link , my approach was to do react-native link react-native-sensor-manager and you are done.
import it using import { SensorManager } from 'NativeModules'
It would definitely work.

android import error

I am trying use the GPE code for App-Android Android-App communication. Both the two new created folders (Android, AppEngine) have errors. I think the problem is that there are
errors with the packages:
import com.google.web.bindery.requestfactory.shared.InstanceRequest;
import com.google.web.bindery.requestfactory.shared.Request;
import com.google.web.bindery.requestfactory.shared.RequestContext;
import com.google.web.bindery.requestfactory.shared.RequestFactory;
import com.google.web.bindery.requestfactory.shared.ServiceName;
It says "The import com.google.web cannot be resolved." I tried adding everything able to be checked checked in the build path. I also know I installed the Web Toolkit and everything. What is wrong?
Statements like the following also have error markings:
#ProxyForName(value = "com.glm.server.Message",
locator = "com.glm.server.MessageLocator") and actually there are so many errors it must be the imports.

Categories

Resources