NativeScript cra sh из виджета на Android - PullRequest
0 голосов
/ 29 апреля 2020

Иногда, когда я запускаю или обновляю sh мое приложение NS- Vue, я получаю этот cra sh при рендеринге первой страницы:

System.err: An uncaught Exception occurred on "main" thread.
System.err: Calling js method onCreateView failed
System.err: Error: java.lang.NoSuchMethodError: no non-static method "Lorg/nativescript/widgets/GridLayout;.addView(Ljava/lang/String;[CLnet/sqlcipher/database/SQLiteDatabase$CursorFactory;ILnet/sqlcipher/database/SQLiteDatabaseHook;Lnet/sqlcipher/DatabaseErrorHandler;)Lnet/sqlcipher/database/SQLiteDatabase;"
System.err: 
System.err: StackTrace:
System.err: CustomLayoutView._addViewToNativeVisualTree(file: node_modules\@nativescript\core\ui\core\view\view.android.js:832:37)
System.err:     at Page._addViewToNativeVisualTree(file: node_modules\@nativescript\core\ui\page\page.android.js:40:59)
System.err:     at ViewBase._setupUI(file: node_modules\@nativescript\core\ui\core\view-base\view-base.js:549:58)
System.err:     at (file: node_modules\@nativescript\core\ui\core\view-base\view-base.js:553:18)
System.err:     at ContentView.eachChildView(file: node_modules\@nativescript\core\ui\content-view\content-view.js:70:12)
System.err:     at PageBase.eachChildView(file: node_modules\@nativescript\core\ui\page\page-common.js:126:39)
System.err:     at ViewCommon.eachChild(file: node_modules\@nativescript\core\ui\core\view\view-common.js:925:13)
System.err:     at ViewBase._setupUI(file: node_modules\@nativescript\core\ui\core\view-base\view-base.js:552:13)
System.err:     at ViewBase._addViewCore(file: node_modules\@nativescript\core\ui\core\view-base\view-base.js:448:17)
System.err:     at ViewBase._addView(file: node_modules\@nativescript\core\ui\core\view-base\view-base.js:437:13)
System.err:     at FragmentCallbacksImplementation.onCreateView(file: node_modules\@nativescript\core\ui\frame\frame.android.js:700:18)
System.err:     at FragmentClass.onCreateView(file: node_modules\@nativescript\core\ui\frame\fragment.android.js:29:37)
System.err:     at com.tns.Runtime.callJSMethodNative(Native Method)
System.err:     at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1286)
System.err:     at com.tns.Runtime.callJSMethodImpl(Runtime.java:1173)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1160)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1138)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1134)
System.err:     at com.tns.FragmentClass.onCreateView(FragmentClass.java:53)
System.err:     at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2439)
System.err:     at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460)
System.err:     at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)
System.err:     at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)
System.err:     at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:802)
System.err:     at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)
System.err:     at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)
System.err:     at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
System.err:     at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2273)
System.err:     at androidx.fragment.app.FragmentManagerImpl$1.run(FragmentManager.java:733)
System.err:     at android.os.Handler.handleCallback(Handler.java:808)
System.err:     at android.os.Handler.dispatchMessage(Handler.java:101)
System.err:     at android.os.Looper.loop(Looper.java:166)
System.err:     at android.app.ActivityThread.main(ActivityThread.java:7529)
System.err:     at java.lang.reflect.Method.invoke(Native Method)
System.err:     at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
System.err: Caused by: java.lang.NoSuchMethodError: no non-static method "Lorg/nativescript/widgets/GridLayout;.addView(Ljava/lang/String;[CLnet/sqlcipher/database/SQLiteDatabase$CursorFactory;ILnet/sqlcipher/database/SQLiteDatabaseHook;Lnet/sqlcipher/DatabaseErrorHandler;)Lnet/sqlcipher/database/SQLiteDatabase;"
System.err:     ... 24 more

Иногда я также получаю Calling js method run failed или другие ошибки, связанные с виджетами. После некоторого расследования я думаю, что это может быть проблема с плагином. На main.js я инициализирую следующие виджеты плагинов: nativescript-checkbox, nativescript-Drawingpad, RadlListView и RadAutoCompleteTextView.

В любом случае, это код первой страницы:

<template>
    <PageFrame :title="'login.login' | L">
        <GridLayout columns="2* 3* 2*">
            <GridLayout col="1" columns="auto *" rows="auto auto auto auto auto" class="container">

                <Image row="0" col="0" colSpan="2" src="~/assets/images/logo.png" />

                <Label row="1" col="0" class="label" :text="'login.username' | L" />
                <GridLayout row="1" col="1" columns="* auto" class="input-stk">
                    <TextField col="0" v-model="username" :hint="'insert' | L" :autocorrect="false" />
                    <Label col="1" :text="'fa-times' | fonticon" class="fa" @tap="username = ''" />
                </GridLayout>

                <Label row="2" col="0" class="label" :text="'login.password' | L" />
                <GridLayout row="2" col="1" columns="* auto" class="input-stk pwd">
                    <TextField col="0" v-model="password" :hint="'insert' | L" :autocorrect="false" secure="true" />
                    <Label col="1" :text="'fa-times' | fonticon" class="fa" @tap="password = ''" />
                </GridLayout>

                <FlexboxLayout row="3" col="0" colSpan="2" class="btn-el" @tap="login" :class="{'disabled': loginDisabled}">
                    <ActivityIndicator v-if="loading" busy="true" />
                    <Label v-else :text="'login.accedi' | L" />
                </FlexboxLayout>

                <FlexboxLayout v-if="allowChangePassword" row="4" col="0" colSpan="2" class="btn-el" :class="{'pink': !loginDisabled}" @tap="changePassword">
                    <Label :text="'login.cambiaPassword' | L" />
                </FlexboxLayout>

            </GridLayout>
        </GridLayout>
    </PageFrame>
</template>

PageFrame компонент:

<template>
    <Page actionBarHidden="true" @navigatedTo="onNavigatedTo">
        <GridLayout class="app-cnt" rows="auto *">

            <GridLayout row="0" :columns="'*' + (actions ? ' auto'.repeat(actions.length) : '')" class="action-bar">
                <Label col="0" :text="title" class="bold" />
                <FlexboxLayout v-for="(action, i) in actions" :key="i" :col="i+1" @tap="action.onTap()" class="icon-cnt" >
                    <Label class="fa" :text="action.icon | fonticon" />
                </FlexboxLayout>
            </GridLayout>


            <GridLayout row="1">
                <slot />
            </GridLayout>

            <Label row="1" class="bottom-shadow" />

            <GridLayout row="1" v-if="loadingIndicator" class="while-loading">
                <ActivityIndicator  busy="true" />
            </GridLayout>


        </GridLayout>
    </Page>
</template>

Зависимости:

"dependencies": {
    "@nativescript/theme": "^2.2.1",
    "@nstudio/nativescript-checkbox": "^1.0.0",
    "axios": "^0.19.0",
    "crypto-js": "^4.0.0",
    "hi-base32": "^0.5.0",
    "md5": "^2.2.1",
    "moment": "^2.24.0",
    "nativescript-bitmap-factory": "^1.8.1",
    "nativescript-bluetooth": "^3.0.0-beta.10",
    "nativescript-camera": "^4.5.0",
    "nativescript-drawingpad": "^3.1.0",
    "nativescript-feedback": "^1.3.12",
    "nativescript-fonticon": "^2.0.0",
    "nativescript-geolocation": "^5.1.0",
    "nativescript-iqkeyboardmanager": "^1.5.1",
    "nativescript-localize": "^4.2.1",
    "nativescript-modal-datetimepicker": "^1.2.2",
    "nativescript-print-zebra": "file:nativescript-print-zebra-1.2.0.tgz",
    "nativescript-printer": "^1.5.0",
    "nativescript-sqlite": "^2.6.0",
    "nativescript-sqlite-commercial": "file:nativescript-sqlite-commercial-1.3.2.tgz",
    "nativescript-sqlite-encrypted": "file:nativescript-sqlite-encrypted-1.4.0.tgz",
    "nativescript-toasty": "^3.0.0-alpha.2",
    "nativescript-ui-autocomplete": "^6.0.1",
    "nativescript-ui-listview": "^8.1.2",
    "nativescript-vue": "^2.5.0",
    "nativescript-zip": "^4.0.2",
    "pdfmake": "^0.1.63",
    "tns-core-modules": "^6.5.1",
    "vuex": "^3.1.2",
    "xml-js": "^1.6.11"
},
"devDependencies": {
    "@babel/core": "^7.0.0",
    "@babel/preset-env": "^7.0.0",
    "babel-loader": "^8.0.2",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^6.2.2",
    "nativescript-dev-webpack": "^1.3.0",
    "nativescript-vue-template-compiler": "^2.5.0",
    "node-sass": "^4.13.1",
    "vue-loader": "^15.9.0"
}

Любая помощь, пожалуйста?

...