I'm trying to make a NativeScript app write logs to Azure AppInsight. I'm using npm package "#microsoft/applicationinsights-web" for that (2.5.8).
Upon the application start I'm getting this error while trying to call new ApplicationInsights():
System.err: TypeError: Cannot assign to read only property '__extends' of object '[object global]'
System.err: File: (file: node_modules\#microsoft\applicationinsights-shims\dist-esm\applicationinsights-shims.js:96:0)
System.err:
System.err: StackTrace:
System.err: (file: node_modules\#microsoft\applicationinsights-shims\dist-esm\applicationinsights-shims.js:96:0)
System.err: at (file: node_modules\#microsoft\applicationinsights-shims\dist-esm\applicationinsights-shims.js:97:1)
System.err: at ../node_modules/#microsoft/applicationinsights-shims/dist-esm/applicationinsights-shims.js(file:///data/data/com.mycompany.live/files/app/vendor.js:95073:30)
System.err: at __webpack_require__(file: src\webpack\bootstrap:753:0)
System.err: at fn(file: src\webpack\bootstrap:120:0)
System.err: at ../node_modules/#microsoft/applicationinsights-web/dist-esm/applicationinsights-web.js(file: node_modules\#microsoft\applicationinsights-web\dist-esm\applicationinsights-web.js:1:0)
System.err: at __webpack_require__(file: src\webpack\bootstrap:753:0)
System.err: at fn(file: src\webpack\bootstrap:120:0)
System.err: at ./app/shared/tracking.service.ts(file:///data/data/com.mycompany.live/files/app/bundle.js:1681:92)
System.err: at __webpack_require__(file: src\webpack\bootstrap:753:0)
System.err: at fn(file: src\webpack\bootstrap:120:0)
System.err: at ./app/shared/default-error-handler.service.ts(file:///data/data/com.mycompany.live/files/app/bundle.js:1316:75)
System.err: at __webpack_require__(file: src\webpack\bootstrap:753:0)
System.err: at fn(file: src\webpack\bootstrap:120:0)
System.err: at ./app/shared/index.ts(file:///data/data/com.mycompany.live/files/app/bundle.js:1351:88)
System.err: at __webpack_require__(file: src\webpack\bootstrap:753:0)
System.err: at fn(file: src\webpack\bootstrap:120:0)
System.err: at ./app/app.module.ts(file:///data/data/com.mycompany.live/files/app/bundle.js:214:66)
System.err: at __webpack_require__(file: src\webpack\bootstrap:753:0)
System.err: at fn(file: src\webpack\bootstrap:120:0)
System.err: at (file:///data/data/com.mycompany.live/files/app/bundle.js:2027:73)
System.err: at ./main.ts(file:///data/data/com.mycompany.live/files/app/bundle.js:2095:30)
System.err: at __webpack_require__(file: src\webpack\bootstrap:753:0)
System.err: at checkDeferredModules(file: src\webpack\bootstrap:43:0)
System.err: at webpackJsonpCallback(file: src\webpack\bootstrap:30:0)
System.err: at (file:///data/data/com.mycompany.live/files/app/bundle.js:2:57)
System.err: at require(:1:266)
I wonder if someone has already found a solution for this issue.
Related
Could help me. I tried implement Android library in Nativescript.
I create Android Project -> New Module -> Andorid library.
Create Java Class
platforms\android\nativescript-serial-port\serialport\src\main\java\com\nativescript\serialport\Toaster.java
package com.nativescript.serialport;
import android.content.Context;
import android.widget.Toast;
public class Toaster {
public Toaster() {}
public void show(Context context) {
Toast.makeText(context, "Hello NativeScript!", Toast.LENGTH_SHORT).show();
}
}
Add in file nativescript project platforms\android\settings.gradle
include ':app', ':serialport'
project(':serialport').projectDir = new File('nativescript-serial-port/serialport')
Add in file nativescript app app\App_Resources\Android\app.gradle
dependencies {
implementation project(":serialport")
}
Add in JS file nativescript project some-file.js
import * as app from 'application';
const context = android.content.Context;
const toaster = new com.nativescript.serialport.Toaster();
toaster.show(context);
And if I run this code appear error
System.err: TypeError: com.nativescript.serialport.Toaster is not a constructor
System.err: File: "file:///data/data/org.nativescript.application/files/app/bundle.js,
line: 372, column: 22
System.err:
System.err: StackTrace:
System.err: Frame: function:'onPrint', file:'file:///data/data/org.nativescript.application/files/app/bundle.js',
line: 372, column: 23
System.err: Frame: function:'invoker', file:'file:///data/data/org.nativescript.application/files/app/vendor.js',
line: 4168, column: 18
System.err: Frame: function:'Observable.notify', file:'file:///data/data/org.nativescript.application/files/app/vendor.js',
line: 17698, column: 15
System.err: Frame: function:'Observable._emit', file:'file:///data/data/org.nativescript.application/files/app/vendor.js',
line: 17726, column: 12
System.err: Frame: function:'ClickListenerImpl.onClick', file:'file:///data/data/org.nativescript.application/files/app/vendor.js',
line: 29193, column: 15
System.err:
System.err: at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1120)
System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:1000)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:987)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:967)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:959)
System.err: at com.tns.gen.java.lang.Object_vendor_29183_26_ClickListenerImpl.onClick(Object_vendor_29183_26_ClickListenerImpl.java:17)
System.err: at android.view.View.performClick(View.java:6597)
System.err: at android.view.View.performClickInternal(View.java:6574)
System.err: at android.view.View.access$3100(View.java:778)
System.err: at android.view.View$PerformClick.run(View.java:25885)
System.err: at android.os.Handler.h
andleCallback(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)
How fix this error. Thanks
I am working on an android app using Xamarin and receive the following exception.
Xamarin caused by: android.runtime.JavaProxyThrowable: System.ArgumentException: Handle must be valid.
Parameter name: instance
at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0000d] in <1bc3ec2e392f4f1a8cde1c9a163d2a4a>:0
at Android.Runtime.JNIEnv.CallVoidMethod (System.IntPtr jobject, System.IntPtr jmethod, Android.Runtime.JValue* parms) [0x0000e] in <0ce7e7a03dfb4c4b87eaf38b0e480d65>:0
at Android.Support.V4.Widget.SwipeRefreshLayout.set_Refreshing (System.Boolean value) [0x00060] in <27c17fe440cf491ba8255bcefade6e02>:0
at Xamarin.Forms.Platform.Android.ListViewRenderer.<UpdateIsRefreshing>b__25_0 () [0x00000] in <a3e44144fef249b0888b761605dfca24>:0
at Java.Lang.Thread+RunnableImplementor.Run () [0x0000b] in <0ce7e7a03dfb4c4b87eaf38b0e480d65>:0
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <0ce7e7a03dfb4c4b87eaf38b0e480d65>:0
at (wrapper dynamic-method) System.Object:ffc21647-8320-4065-b329-c8e7939eb92d (intptr,intptr)
at mono.java.lang.RunnableImplementor.n_run(Native Method)
at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
I've tried adding a txt file, environment.txt, with the property to set the GC to old. However that did not work.
What other issues could cause this exception?
I am binding the java library Material CalendarView. With a set of 12 transforms in Metadata.xml I could bind the library with 0 errors and 15 warnings. I have added Support Library v4 Component ver 23.1.1 in the binding project as the jar file had a dependency on that. Also I have ensured that all the Resource assets are included in the jar file.
When I use this library in an Android Sample like below,
var materialCalendar= new MaterialCalendarView(this);
this exception gets thrown
Failed resolution of: Lcom/prolificinteractive/materialcalendarview/R$drawable;
Java.Lang.NoClassDefFoundError: Failed resolution of: Lcom/prolificinteractive/materialcalendarview/R$drawable; ---> Java.Lang.ClassNotFoundException: Didn't find class "com.prolificinteractive.materialcalendarview.R$drawable" on path: DexPathList[[zip file "/data/app/com.fingent.materialcalendarsample-1/base.apk"],nativeLibraryDirectories=[/data/app/com.fingent.materialcalendarsample-1/lib/x86, /vendor/lib, /system/lib]]
at --- End of managed exception stack trace ---
at java.lang.ClassNotFoundException: Didn't find class "com.prolificinteractive.materialcalendarview.R$drawable" on path: DexPathList[[zip file "/data/app/com.fingent.materialcalendarsample-1/base.apk"],nativeLibraryDirectories=[/data/app/com.fingent.materialcalendarsample-1/lib/x86, /vendor/lib, /system/lib]]
at at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.setupChildren(MaterialCalendarView.java:358)
at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.<init>(MaterialCalendarView.java:237)
at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.<init>(MaterialCalendarView.java:216)
at at md56fd5622393123d59c6c51d78708f2ed2.MainActivity.n_onCreate(Native Method)
at at md56fd5622393123d59c6c51d78708f2ed2.MainActivity.onCreate(MainActivity.java:28)
at at android.app.Activity.performCreate(Activity.java:5990)
at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at at android.app.ActivityThread.access$800(ActivityThread.java:151)
at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at at android.os.Handler.dispatchMessage(Handler.java:102)
at at android.os.Looper.loop(Looper.java:135)
at at android.app.ActivityThread.main(ActivityThread.java:5254)
at at java.lang.reflect.Method.invoke(Native Method)
at at java.lang.reflect.Method.invoke(Method.java:372)
at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
at Suppressed: java.lang.ClassNotFoundException: com.prolificinteractive.materialcalendarview.R$drawable
at at java.lang.Class.classForName(Native Method)
at at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
at ... 19 more
at Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
--- End of inner exception stack trace ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (IntPtr jobject, IntPtr jclass, IntPtr jmethod, Android.Runtime.JValue* parms) [0x00084] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1029
at Android.Runtime.JNIEnv.FinishCreateInstance (IntPtr instance, IntPtr jclass, IntPtr constructorId, Android.Runtime.JValue* constructorParameters) [0x0000b] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:306
at MaterialCalendarLibrary.MaterialCalendarView..ctor (Android.Content.Context p0) [0x000c5] in /Users/fingent/Projects/MaterialCalendarLibrary/MaterialCalendarLibrary/obj/Release/generated/src/MaterialCalendarLibrary.MaterialCalendarView.cs:505
at MaterialCalendarSample.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x00009] in /Users/fingent/Documents/sreeraj/workspace/Xamarin.MaterialCalendarView/MaterialCalendarSample/MainActivity.cs:17
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) [0x00011] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.App.Activity.cs:2475
at at (wrapper dynamic-method) System.Object:0b8c341c-2f19-42d5-83e9-b3a815827e69 (intptr,intptr,intptr)
at --- End of managed exception stack trace ---
at java.lang.NoClassDefFoundError: Failed resolution of: Lcom/prolificinteractive/materialcalendarview/R$drawable;
at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.setupChildren(MaterialCalendarView.java:358)
at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.<init>(MaterialCalendarView.java:237)
at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.<init>(MaterialCalendarView.java:216)
at at md56fd5622393123d59c6c51d78708f2ed2.MainActivity.n_onCreate(Native Method)
at at md56fd5622393123d59c6c51d78708f2ed2.MainActivity.onCreate(MainActivity.java:28)
at at android.app.Activity.performCreate(Activity.java:5990)
at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at at android.app.ActivityThread.access$800(ActivityThread.java:151)
at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at at android.os.Handler.dispatchMessage(Handler.java:102)
at at android.os.Looper.loop(Looper.java:135)
at at android.app.ActivityThread.main(ActivityThread.java:5254)
at at java.lang.reflect.Method.invoke(Native Method)
at at java.lang.reflect.Method.invoke(Method.java:372)
at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
at Caused by: java.lang.ClassNotFoundException: Didn't find class "com.prolificinteractive.materialcalendarview.R$drawable" on path: DexPathList[[zip file "/data/app/com.fingent.materialcalendarsample-1/base.apk"],nativeLibraryDirectories=[/data/app/com.fingent.materialcalendarsample-1/lib/x86, /vendor/lib, /system/lib]]
at at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at ... 18 more
at Suppressed: java.lang.ClassNotFoundException: com.prolificinteractive.materialcalendarview.R$drawable
at at java.lang.Class.classForName(Native Method)
at at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
at ... 19 more
at Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
Here is the link to the project in Github Xamarin Material CalendarView
It's about missing Resources that should be attached in Material CalendarView, you need an AAR file.
Just go Maven and get latest AAR file that published by Author: http://mvnrepository.com/artifact/com.prolificinteractive/material-calendarview/1.2.0
Remove the material-calendarview.jar and drag new file material-calendarview-1.2.0.aar on your binding project, done!
A Drawable is a graphic resource and the Java exception is on the following line (from the lib your binding):
buttonPast.setImageResource(R.drawable.mcv_action_previous);
So you are missing mcv_action_previous which a PNG-based arrow located in the res/drawable-xxxhdpi/mcv_action_previous.png within the project that you are binding.
Are all the resources included? Any of your binding transformations or binding warning about resources?
12-21 16:36:20.522 24309-24309/islamicapp.com.ranatechnology.ww.tawfiiqislamiccenter E/AndroidRuntime: FATAL EXCEPTION: main
Process: islamicapp.com.ranatechnology.ww.tawfiiqislamiccenter, PID: 24309
java.lang.OutOfMemoryError: pthread_create (stack size 16384 bytes) failed: Try again
at java.lang.VMThread.create(Native Method)
at java.lang.Thread.start(Thread.java:1029)
at com.android.volley.RequestQueue.start(RequestQueue.java:152)
at com.android.volley.toolbox.Volley.newRequestQueue(Volley.java:79)
at com.android.volley.toolbox.Volley.newRequestQueue(Volley.java:105)
at com.android.volley.toolbox.Volley.newRequestQueue(Volley.java:115)
at islamicapp.com.ranatechnology.ww.Service.NotificationService.servicestart(NotificationService.java:139)
at islamicapp.com.ranatechnology.ww.Service.NotificationService.onStartCommand(NotificationService.java:58)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2712)
at android.app.ActivityThread.access$2100(ActivityThread.java:142)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5120)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
at dalvik.system.NativeStart.main(Native Method)
I have a problem with using the Jersey Client
I am using jersey-bundle-1.17.1.jar
When i try to create a Client i throw at Runtime.
Client c = Client.create();
logcat:
01-29 12:46:52.578 13862-13862/com.example.spar.navigationdrawer E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.spar.navigationdrawer, PID: 13862
java.lang.VerifyError: com/sun/jersey/core/impl/provider/entity/MimeMultipartProvider
at java.lang.Class.getDeclaredConstructors(Native Method)
at java.lang.Class.getConstructors(Class.java:508)
at com.sun.jersey.core.spi.component.ComponentConstructor.getInstance(ComponentConstructor.java:174)
at com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:166)
at com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:137)
at com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:256)
at com.sun.jersey.core.spi.component.ProviderServices.getServices(ProviderServices.java:160)
at com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:176)
at com.sun.jersey.core.spi.factory.MessageBodyFactory.init(MessageBodyFactory.java:162)
at com.sun.jersey.api.client.Client.init(Client.java:342)
at com.sun.jersey.api.client.Client.access$000(Client.java:118)
at com.sun.jersey.api.client.Client$1.f(Client.java:191)
at com.sun.jersey.api.client.Client$1.f(Client.java:187)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
at com.sun.jersey.api.client.Client.<init>(Client.java:187)
at com.sun.jersey.api.client.Client.<init>(Client.java:159)
at com.sun.jersey.api.client.Client.create(Client.java:669)
at com.example.spar.navigationdrawer.client.ArticleClient.getArticles(ArticleClient.java:38)
at com.example.spar.navigationdrawer.MyActivity.<init>(MyActivity.java:72)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1208)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2122)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5146)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
at dalvik.system.NativeStart.main(Native Method)