Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weexpack+natjs #10

Open
JiangWeixian opened this issue May 18, 2018 · 2 comments
Open

weexpack+natjs #10

JiangWeixian opened this issue May 18, 2018 · 2 comments

Comments

@JiangWeixian
Copy link

起因是我使用natjs调用摄像头会闪退,以及页面无法跳转。而nat-explorer下载的没有问题。我创建的工程如下:

weexpack create xxx
// 安装配置使用最新的weex、babel-stage-0以及没有使用vue-router
cd xxx
npm install
npm install natjs --save
npm install less less-loader pug --save-dev
weexpack platform add android
weexpack plugin add xxx-camear xxx-image xxx-modal

AndroidManifest.xml添加

<activity
            android:name="com.weex.app.WXPageActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <action android:name="com.weex.app.protocol.openurl"/>

                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="com.taobao.android.intent.category.WEEX"/>

                <data android:scheme="http"/>
                <data android:scheme="https"/>
                <data android:scheme="file"/>
            </intent-filter>
        </activity>

然后把nat-explorer源码内src目录下拷贝过来一份

npm run android

成功安装app,首页也没有问题。问题在于无法点击进去子页面。

  • 以及我尝试nat.toast点击路径,是和nat-explorer一致的。
  • 由于是可以点击的,我尝试在主页上直接添加摄像头函数,来自na-explorer/src/views/camera.vue。这个时候应用闪退。

weex文档实在太少,希望作者解答。

之后,我下载了nat-explorer源码,然后npm install & npm run android。这个是没有问题的。
和下载的app一样。

请问这两个还有什么细节上实现差异吗?

@acathur
Copy link
Member

acathur commented May 25, 2018

请提供一下Android Studio的报错日志
weex初始化的项目文件比较混乱,代码中调用的方法经常与对应的SDK不符合,需要做小幅修改

@xcqweb
Copy link

xcqweb commented Oct 25, 2018

我也遇到这个问题 以下是android stutdio 中错误提示

E/SafeRunnable: SafeRunnable run throw expection:java.lang.reflect.InvocationTargetException
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.weex.app, PID: 6654
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.taobao.weex.bridge.NativeInvokeHelper$1.run(NativeInvokeHelper.java:50)
at com.taobao.weex.common.WXThread$SafeRunnable.run(WXThread.java:49)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.taobao.weex.bridge.MethodInvoker.invoke(MethodInvoker.java:46)
at com.taobao.weex.bridge.NativeInvokeHelper$1.run(NativeInvokeHelper.java:48)
at com.taobao.weex.common.WXThread$SafeRunnable.run(WXThread.java:49) 
at android.os.Handler.handleCallback(Handler.java:751) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6077) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756) 
Caused by: android.os.FileUriExposedException: file:///storage/emulated/0/Instapp/nat_video_1540430743200.mov exposed beyond app through ClipData.Item.getUri()
at android.os.StrictMode.onFileUriExposed(StrictMode.java:1799)
at android.net.Uri.checkFileUriExposed(Uri.java:2346)
at android.content.ClipData.prepareToLeaveProcess(ClipData.java:832)
at android.content.Intent.prepareToLeaveProcess(Intent.java:8909)
at android.content.Intent.prepareToLeaveProcess(Intent.java:8894)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1517)
at android.app.Activity.startActivityForResult(Activity.java:4224)
at android.support.v4.app.BaseFragmentActivityApi16.startActivityForResult(BaseFragmentActivityApi16.java:54)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:67)
at android.app.Activity.startActivityForResult(Activity.java:4183)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:720)
at com.instapp.nat.camera.CameraModule.captureVideo(CameraModule.java:109)
at com.instapp.nat.weex.plugin.Camera.Camera.realCaptureVideo(Camera.java:92)
at com.instapp.nat.weex.plugin.Camera.Camera.captureVideo(Camera.java:86)
at java.lang.reflect.Method.invoke(Native Method) 
at com.taobao.weex.bridge.MethodInvoker.invoke(MethodInvoker.java:46) 
at com.taobao.weex.bridge.NativeInvokeHelper$1.run(NativeInvokeHelper.java:48) 
at com.taobao.weex.common.WXThread$SafeRunnable.run(WXThread.java:49) 
at android.os.Handler.handleCallback(Handler.java:751) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6077) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants