crazycodeboy / react-native-splash-screen

A splash screen for react-native, hide when application loaded ,it works on iOS and Android.
MIT License
5.62k stars 1.1k forks source link

Android 使用打包后出现 应用停止运行 的情况 !!!!! #179

Open Monika-LeeAn opened 6 years ago

Monika-LeeAn commented 6 years ago

现在的Splash 不管是最新的版本3.0.6 还是以前用的版本 2.1.0 现在正常的直接插入手机测试是没有问题的。但一打包运行就出现下面的问题,求解!!!!!!!

android.view.WindowLeaked: Activity com.demo.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{3eb54e9 V.E..... R....... 0,0-540,960} that was originally added here E/WindowManager( 4236): at android.view.ViewRootImpl.(ViewRootImpl.java:363) E/WindowManager( 4236): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:271) E/WindowManager( 4236): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85) E/WindowManager( 4236): at android.app.Dialog.show(Dialog.java:298) E/WindowManager( 4236): at com.cboy.rn.splashscreen.SplashScreen$1.run(SplashScreen.java:34) E/WindowManager( 4236): at android.app.Activity.runOnUiThread(Activity.java:5293) E/WindowManager( 4236): at com.cboy.rn.splashscreen.SplashScreen.show(SplashScreen.java:24) E/WindowManager( 4236): at com.cboy.rn.splashscreen.SplashScreen.show(SplashScreen.java:44) E/WindowManager( 4236): at com.demo.MainActivity.onCreate(MainActivity.java:14) E/WindowManager( 4236): at android.app.Activity.performCreate(Activity.java:5990) E/WindowManager( 4236): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) E/WindowManager( 4236): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) E/WindowManager( 4236): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) E/WindowManager( 4236): at android.app.ActivityThread.access$800(ActivityThread.java:151) E/WindowManager( 4236): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) E/WindowManager( 4236): at android.os.Handler.dispatchMessage(Handler.java:102) E/WindowManager( 4236): at android.os.Looper.loop(Looper.java:135) E/WindowManager( 4236): at android.app.ActivityThread.main(ActivityThread.java:5254) E/WindowManager( 4236): at java.lang.reflect.Method.invoke(Native Method) E/WindowManager( 4236): at java.lang.reflect.Method.invoke(Method.java:372) E/WindowManager( 4236): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905) E/WindowManager( 4236): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)

yu629 commented 6 years ago

+1

mengerzhuanyong commented 6 years ago

+1 希望抓紧解决呀

donglyu commented 6 years ago

我也遇到遇到这个问题了,但我的log日志不是这样的。昨晚查原因,修复改好了,在这儿写一下,可能对其他人有帮助。应该还是库和RN库版本用的不一致的原因

我通过Android studio打包测试查看log发现是打包成index.android.bundle文件的时候,问题出在View.propTypes.style这类语句中,在某个RN版本后,propTypes换了地方。

import PropTypes from 'prop-types';

so,我就把工程中所有格式校验的先注释了,就行了。至于应该怎么写,还没去弄,刚接触RN,要填的坑还很多。

Hud.propTypes = {
    // style: View.propTypes.style,   // here
    // textStyle: Text.propTypes.style,   // here
    fadeInDuration: PropTypes.number,
    fadeOutDuration: PropTypes.number,
    opacity: PropTypes.number,
    positionValue: PropTypes.number,
    // source: Image.propTypes.source,  // here
    textOnly: PropTypes.bool,
    hudType: PropTypes.oneOf([
        'info',
        'success',
        'error',
        'none',
    ]),
    // imageStyle:Image.propTypes.style,   // here
    backgroundTouchable:PropTypes.bool,
};
Monika-LeeAn commented 6 years ago

@donglyu 嗯,你的这个解决方法跟我的一样。我的项目里面还出现了一句 ...View.propTypes, 看到了也要注释掉。

HeiSiBaby commented 6 years ago

可以具体一点吗? 我现在也遇到这个问题了

Monika-LeeAn commented 5 years ago

react-native : 0.57.1 同样出现了这个问题
解决方案: app/build.gradle 中 修改以下

project.ext.react = [ entryFile: "index.js", jsBundleDirRelease: "$buildDir/intermediates/merged_assets/release/mergeReleaseAssets/out" ]