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

Cannot read mkdirs of null #90

Closed
kryptus36 opened this issue Nov 1, 2021 · 14 comments
Closed

Cannot read mkdirs of null #90

kryptus36 opened this issue Nov 1, 2021 · 14 comments

Comments

@kryptus36
Copy link

I'm not sure if this issue is in core, ui-lottie or I'm missing something?

I've made sure my file is in the right place.

System.err: An uncaught Exception occurred on "main" thread.
System.err: Calling js method onCreateView failed
System.err: TypeError: Cannot read property 'mkdirs' of null
System.err:
System.err: StackTrace:
System.err: ensureFile(file: node_modules/@nativescript/core/file-system/file-system-access.android.js:387:0)
System.err: at getFile(file: node_modules/@nativescript/core/file-system/file-system-access.android.js:41:0)
System.err: at fromPath(file: node_modules/@nativescript/core/file-system/index.js:136:0)
System.err: at loadLottieJSON(file: node_modules/@nativescript-community/ui-lottie/lottie.android.js:20:21)
System.err: at setSrc(file: node_modules/@nativescript-community/ui-lottie/lottie.android.js:127:0)
System.err: at [src:setNative](file: node_modules/@nativescript-community/ui-lottie/lottie.android.js:136:0)
System.err: at applyAllNativeSetters(file: node_modules/@nativescript/core/ui/core/properties/index.js:1136:0)
System.err: at initNativeView(file: node_modules/@nativescript/core/ui/core/properties/index.js:1079:0)
System.err: at onResumeNativeUpdates(file: node_modules/@nativescript/core/ui/core/view-base/index.js:737:22)
System.err: at _resumeNativeUpdates(file: node_modules/@nativescript/core/ui/core/view-base/index.js:280:0)
System.err: at onLoaded(file: node_modules/@nativescript/core/ui/core/view-base/index.js:235:0)
System.err: at onLoaded(file: node_modules/@nativescript/core/ui/core/view/index.android.js:309:0)
System.err: at (file: node_modules/@nativescript/core/ui/core/view-base/index.js:318:0)
System.err: at callFunctionWithSuper(file: node_modules/@nativescript/core/ui/core/view-base/index.js:312:0)
System.err: at callLoaded(file: node_modules/@nativescript/core/ui/core/view-base/index.js:318:0)
System.err: at loadView(file: node_modules/@nativescript/core/ui/core/view-base/index.js:458:0)
System.err: at (file: node_modules/@nativescript/core/ui/core/view-base/index.js:237:0)
System.err: at eachChildView(file: node_modules/@nativescript/core/ui/layouts/layout-base-common.js:101:0)
System.err: at eachChild(file: node_modules/@nativescript/core/ui/core/view/view-common.js:759:0)
System.err: at onLoaded(file: node_modules/@nativescript/core/ui/core/view-base/index.js:236:0)
System.err: at onLoaded(file: node_modules/@nativescript/core/ui/core/view/index.android.js:309:0)
System.err: at (file: node_modules/@nativescript/core/ui/core/view-base/index.js:318:0)
System.err: at callFunctionWithSuper(file: node_modules/@nativescript/core/ui/core/view-base/index.js:312:0)
System.err: at callLoaded(file: node_modules/@nativescript/core/ui/core/view-base/index.js:318:0)
System.err: at loadView(file: node_modules/@nativescript/core/ui/core/view-base/index.js:458:0)
System.err: at (file: node_modules/@nativescript/core/ui/core/view-base/index.js:237:0)
System.err: at eachChildView(file: node_modules/@nativescript/core/ui/content-view/index.js:65:0)
System.err: at eachChildView(file: node_modules/@nativescript/core/ui/page/page-common.js:106:0)
System.err: at eachChild(file: node_modules/@nativescript/core/ui/core/view/view-common.js:759:0)
System.err: at onLoaded(file: node_modules/@nativescript/core/ui/core/view-base/index.js:236:0)
System.err: at onLoaded(file: node_modules/@nativescript/core/ui/core/view/index.android.js:309:0)
System.err: at onLoaded(file: node_modules/@nativescript/core/ui/page/index.android.js:38:0)
System.err: at (file: node_modules/@nativescript/core/ui/core/view-base/index.js:318:0)
System.err: at callFunctionWithSuper(file: node_modules/@nativescript/core/ui/core/view-base/index.js:312:0)
System.err: at callLoaded(file: node_modules/@nativescript/core/ui/core/view-base/index.js:318:0)
System.err: at loadView(file: node_modules/@nativescript/core/ui/core/view-base/index.js:458:0)
System.err: at _addViewCore(file: node_modules/@nativescript/core/ui/core/view-base/index.js:453:0)
System.err: at _addView(file: node_modules/@nativescript/core/ui/core/view-base/index.js:439:0)
System.err: at onCreateView(file: node_modules/@nativescript/core/ui/frame/index.android.js:730:0)
System.err: at onCreateView(file: node_modules/@nativescript/core/ui/frame/fragment.android.js:25:0)
System.err: at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1302)
System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:1188)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1175)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1153)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1149)
System.err: at com.tns.FragmentClass.onCreateView(FragmentClass.java:55)
System.err: at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2699)
System.err: at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:320)
System.err: at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1199)
System.err: at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1368)
System.err: at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1446)
System.err: at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1509)
System.err: at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:447)
System.err: at androidx.fragment.app.FragmentManager.executeOps(FragmentManager.java:2181)
System.err: at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2004)
System.err: at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1959)
System.err: at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1861)
System.err: at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:413)
System.err: at android.os.Handler.handleCallback(Handler.java:873)
System.err: at android.os.Handler.dispatchMessage(Handler.java:99)
System.err: at android.os.Looper.loop(Looper.java:193)
System.err: at android.app.ActivityThread.main(ActivityThread.java:6669)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
JS: uncaughterror Error: Calling js method onCreateView failed
JS: TypeError: Cannot read property 'mkdirs' of null
System.err: com.tns.NativeScriptException: Error: Calling js method onCreateView failed
System.err: TypeError: Cannot read property 'mkdirs' of null
System.err: at com.tns.Runtime.passExceptionToJsNative(Native Method)
System.err: at com.tns.Runtime.passUncaughtExceptionToJs(Runtime.java:84)
System.err: at com.tns.NativeScriptUncaughtExceptionHandler.uncaughtException(NativeScriptUncaughtExceptionHandler.java:34)
System.err: at com.google.android.gms.ads.internal.report.b.uncaughtException(:com.google.android.gms.policy_ads_fdr_dynamite@213806100@213806100057.397311113.397311113:3)
System.err: at org.chromium.base.JavaExceptionReporter.uncaughtException(chromium-Monochrome.aab-stable-460608521:6)
System.err: at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
System.err: at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063)
System.err: at com.google.android.gms.ads.internal.report.c.uncaughtException(:com.google.android.gms.policy_ads_fdr_dynamite@213806100@213806100057.397311113.397311113:3)
System.err: at java.lang.Thread.dispatchUncaughtException(Thread.java:1955)

@kryptus36 kryptus36 changed the title Cannot read mkdir of null Cannot read mkdirs of null Nov 1, 2021
@bradmartin
Copy link
Member

Error is on line 387 of the first file in the stack trace. So it's throwing from core file-system on android.

The line is : javaFile.getParentFile().mkdirs(); - so the parent file is returning null causing the issue. Not sure why. Seems like a file is missing.

@kryptus36
Copy link
Author

Right, and the filename in question is a json file, which exists in App_Resources/Android/src/main/assets so I'm a little confused.

@farfromrefug
Copy link
Member

What s the src value ?

@kryptus36
Copy link
Author

kryptus36 commented Nov 1, 2021

src="1801-fireworks.json"

The loaded function just has a console.log call in it (and never fires, obviously)

I'm running the latest nativescript available

@farfromrefug
Copy link
Member

@kryptus36 you did not set any path to the file. It simply cant find it. You need to add the path tothe file

@kryptus36
Copy link
Author

I'm misunderstanding then. From the examples and demo code I thought the path was relative to App_Resources/Android/src/main/assets

What should the path be?

@farfromrefug
Copy link
Member

@kryptus36 depends on where you put it. It works like any resource handling in . like image https://v7.docs.nativescript.org/ui/components/image

@kryptus36
Copy link
Author

kryptus36 commented Nov 2, 2021

When I download LottieLogo1.json from the sample dir on this project and put it in app/assets/lotttie/LottieLogo1.json Then set

<StackLayout> <Lottie:LottieView src="~/assets/lottie/LottieLogo1.json" height="130" loop="true" autoPlay="true" loaded="{{ lottieLoaded }}" /> </StackLayout>

I get

Unable to parse composition

@farfromrefug
Copy link
Member

Much better now please share your package.json.

@kryptus36
Copy link
Author

Thanks for your time on this.

{
  "scripts": {
    "lint": "tslint 'app/**/*.ts' -t verbose"
  },
  "description": "The new way to get bingo information!",
  "license": "SEE LICENSE IN <your-license-filename>",
  "repository": "<fill-your-repository-here>",
  "dependencies": {
    "@nativescript-community/ui-lottie": "^4.3.0",
    "@nativescript-community/ui-pager": "^13.0.11",
    "@nativescript/appversion": "^2.0.0",
    "@nativescript/core": "8.1.5",
    "@nativescript/firebase": "^11.1.3",
    "@nativescript/geolocation": "^7.0.0",
    "@nativescript/iqkeyboardmanager": "^2.0.0",
    "@nativescript/secure-storage": "^3.0.0",
    "@nativescript/theme": "^3.0.0",
    "@nstudio/nativescript-exoplayer": "^5.0.6",
    "@proplugins/nativescript-masked-text-field": "^6.0.0",
    "@proplugins/nativescript-orientation": "^2.5.0",
    "@triniwiz/nativescript-pager": "^13.0.0",
    "@types/node": "^12.12.7",
    "moment": "^2.27.0",
    "moment-timezone": "^0.5.28",
    "nativescript-audio": "^6.2.6",
    "nativescript-google-maps-sdk": "^3.0.2",
    "nativescript-insomnia": "^2.0.0",
    "nativescript-mqtt": "^3.0.1",
    "nativescript-sentry": "^2.0.0",
    "nativescript-ui-listview": "^9.0.2",
    "nativescript-ui-sidedrawer": "^9.0.3",
    "nativescript-webview-interface": "^1.4.4",
    "util": "^0.12.4"
  },
  "devDependencies": {
    "@nativescript/android": "8.1.1",
    "@nativescript/ios": "8.1.0",
    "@nativescript/types": "~8.0.0",
    "@nativescript/webpack": "~5.0.0-beta.0",
    "node-sass": "^4.14.1",
    "tslint": "^6.1.1",
    "typescript": "~4.0.0"
  },
  "prettier": {
    "singleQuote": true,
    "semi": true
  },
  "gitHead": "c06800e52ee1a184ea2dffd12a6702aaa43be4e3",
  "readme": "NativeScript Application",
  "main": "./app/app.ts"
}

@farfromrefug
Copy link
Member

Ok that wont help.as you are using ^. Because of that i dont know which version you are using. You need to look this up in your project

@kryptus36
Copy link
Author

"name": "@nativescript-community/ui-lottie",
"version": "4.3.0",
"description": "NativeScript plugin to expose AirBnB Lottie library",
"main": "lottie",

@farfromrefug
Copy link
Member

@kryptus36 just released 4.3.1 which fixes urls like 1801-fireworks.json
I didnt know about this syntax and it now works.
About your latest issue it is a bit weird i cant reproduce it. Let me know how it goes with latest version

@kryptus36
Copy link
Author

Seems to be working now. Much appreciated!

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