[英]App crashes when login form submit is pressed (testing with generated APK and installed on device) react-native
[英]React-Native App Crashes in Physical Android Device (When Dev Settings Pressed)
因此,我有一个本机应用程序,它在计算机上的仿真器中可以正常工作,但是当我想在真实设备中对其进行检查时,会出现错误。
1.我运行react-native run-android(应用程序安装到真实设备上,只是给出警告关于adb反向,cuz设备的android版本是4.4.2)
2.当应用在真实设备中打开时,显示“无法从资产等中加载脚本”。
3.然后我尝试按照建议打开Dev Settings以通过wifi连接到捆绑包,并且我的应用程序崩溃了。..我尝试在2种不同的设备中都崩溃了。
我使用android设备监视器对其进行了跟踪,但出现以下错误:
07-18 17:03:24.596:E / AndroidRuntime(1160):android.view.InflateException:二进制XML文件行#19:错误膨胀类android.widget.CheckBox 07-18 17:03:24.596:E / AndroidRuntime( 1160):位于android.view.LayoutInflater.createView(LayoutInflater.java:626)07-18 17:03:24.596:E / AndroidRuntime(1160):位于com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater .java:56)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.view.LayoutInflater.onCreateView(LayoutInflater.java:675)07-18 17:03:24.596:E / AndroidRuntime(1160) ):位于android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.view.LayoutInflater.inflate(LayoutInflater.java:470)07- 18 17:03:24.596:E / AndroidRuntime(1160):位于android.view.LayoutInflater.inflate(LayoutInflater.java:398)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.view。 LayoutInflater.inflate(LayoutInflater.java:354)07-18 17:03:24.596:E / AndroidRuntime(1160):a t android.preference.Preference.onCreateView(Preference.java:531)07-18 17:03:24.596:E / AndroidRuntime(1160):at android.preference.Preference.getView(Preference.java:494)07-18 17 :03:24.596:E / AndroidRuntime(1160):位于android.preference.PreferenceGroupAdapter.getView(PreferenceGroupAdapter.java:222)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.widget.AbsListView。 tainerView(AbsListView.java:2742)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.widget.ListView.makeAndAddView(ListView.java:1811)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.widget.ListView.fillDown(ListView.java:697)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.widget.ListView.fillFromTop(ListView.java:763 )07-18 17:03:24.596:E / AndroidRuntime(1160):在android.widget.ListView.layoutChildren(ListView.java:1641)07-18 17:03:24.596:E / AndroidRuntime(1160):在Android .widget.AbsListView.onLayout(AbsListView.java:2567)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.view.View.layout (View.java:15819)07-18 17:03:24.596:E / AndroidRuntime(1160):在android.view.ViewGroup.layout(ViewGroup.java:4884)07-18 17:03:24.596:E / AndroidRuntime (1160):位于android.widget.LinearLayout.setChildFrame(LinearLayout.java:1677)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.widget.LinearLayout.layoutVertical(LinearLayout.java:1531) 07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.widget.LinearLayout.onLayout(LinearLayout.java:1440)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android。 view.View.layout(View.java:15819)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.view.ViewGroup.layout(ViewGroup.java:4884)07-18 17:03: 24.596:E / AndroidRuntime(1160):位于android.widget.LinearLayout.setChildFrame(LinearLayout.java:1677)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.widget.LinearLayout.layoutHorizontal(LinearLayout .java:1666)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.widget.LinearLayout.onLayout(LinearLayout.java:1442)07-18 17:03:24.596:E / And roidRuntime(1160):位于android.view.View.layout(View.java:15819)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.view.ViewGroup.layout(ViewGroup.java:4884 )07-18 17:03:24.596:E / AndroidRuntime(1160):在android.widget.LinearLayout.setChildFrame(LinearLayout.java:1677)07-18 17:03:24.596:E / AndroidRuntime(1160):在Android .widget.LinearLayout.layoutVertical(LinearLayout.java:1531)07-18 17:03:24.596:E / AndroidRuntime(1160):at android.widget.LinearLayout.onLayout(LinearLayout.java:1440)07-18 17:03 :24.596:E / AndroidRuntime(1160):位于android.view.View.layout(View.java:15819)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.view.ViewGroup.layout( ViewGroup.java:4884)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)07-18 17:03:24.596:E / AndroidRuntime( 1160):位于android.widget.FrameLayout.onLayout(FrameLayout.java:388)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.view.View.layout(View.java:15819)07 -18 17:03 :24.596:E / AndroidRuntime(1160):位于android.view.ViewGroup.layout(ViewGroup.java:4884)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.widget.LinearLayout.setChildFrame( LinearLayout.java:1677)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.widget.LinearLayout.layoutVertical(LinearLayout.java:1531)07-18 17:03:24.596:E / AndroidRuntime( 1160):位于android.widget.LinearLayout.onLayout(LinearLayout.java:1440)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.view.View.layout(View.java:15819)07 -18 17:03:24.596:E / AndroidRuntime(1160):位于android.view.ViewGroup.layout(ViewGroup.java:4884)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.widget .FrameLayout.layoutChildren(FrameLayout.java:453)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.widget.FrameLayout.onLayout(FrameLayout.java:388)07-18 17:03:24.596 :E / AndroidRuntime(1160):位于android.view.View.layout(View.java:15819)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.view.ViewGroup.layout(ViewGroup .java:4884)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2391)07-18 17:03:24.596:E / AndroidRuntime(1160) ):位于android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2099)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1270)07- 18 17:03:24.596:E / AndroidRuntime(1160):位于android.view.ViewRootImpl $ TraversalRunnable.run(ViewRootImpl.java:6721)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android。 view.Choreographer $ CallbackRecord.run(Choreographer.java:812)07-18 17:03:24.596:E / AndroidRuntime(1160):在android.view.Choreographer.doCallbacks(Choreographer.java:612)07-18 17: 03:24.596:E / AndroidRuntime(1160):位于android.view.Choreographer.doFrame(Choreographer.java:582)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.view.Choreographer $ FrameDisplayEventReceiver .run(Choreographer.java:798)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.os.Handler.handleC allback(Handler.java:733)07-18 17:03:24.596:E / AndroidRuntime(1160):at android.os.Handler.dispatchMessage(Handler.java:95)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.os.Looper.loop(Looper.java:146)07-18 17:03:24.596:E / AndroidRuntime(1160):位于android.app.ActivityThread.main(ActivityThread.java:5641 )07-18 17:03:24.596:E / AndroidRuntime(1160):at java.lang.reflect.Method.invokeNative(Native Method)07-18 17:03:24.596:E / AndroidRuntime(1160):at java。 lang.reflect.Method.invoke(Method.java:515)07-18 17:03:24.596:E / AndroidRuntime(1160):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1288 )07-18 17:03:24.596:E / AndroidRuntime(1160):位于com.android.internal.os.Zygote 07-18 17:03:24.656:A / libc(1215):致命信号13(SIGPIPE)位于0x000004bf(代码= 0),线程1215(正常运行时间)
有什么想法可以解决这个问题吗?
app / android / app / build.gradle:
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.gotl"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile project(':react-native-track-player')
compile project(':react-native-sound-player')
compile project(':react-native-sound')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
compile 'com.facebook.fresco:animated-gif:1.3.0'
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
我想分享一点,我注意到它在android 4.4.4版本中崩溃,但是在5.0版本中它没有崩溃..所以有人对此有任何想法吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.