Running of the app and getting FATAL EXCEPTION: EventThread during splash screen - java

While downloading the application, you need to click on the Back button,
After restarting the application, click on the Back button
E FATAL EXCEPTION: EventThread
Process: PID: 10231
java.lang.OutOfMemoryError: Failed to allocate a 40 byte allocation with 404992 free bytes and 395KB until OOM, target footprint 268435456, growth limit 268435456; giving up on allocation because <1% of heap free after GC.
at $Proxy3.value(Unknown Source)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getFieldNames(ReflectiveTypeAdapterFactory.java:80)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:161)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
at com.google.gson.Gson.getAdapter(Gson.java:458)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
at com.google.gson.Gson.getAdapter(Gson.java:458)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
at com.google.gson.Gson.getAdapter(Gson.java:458)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
at com.google.gson.Gson.getAdapter(Gson.java:458)
at com.google.gson.Gson.fromJson(Gson.java:931)
at com.google.gson.Gson.fromJson(Gson.java:897)
at com.google.gson.Gson.fromJson(Gson.java:846)
at repos.events.EventsRepository.parseOddsOrFixture(EventsRepository.kt:8)
at repos.events.EventsRepository.addSocketListeners$lambda$1(EventsRepository.kt:118)
at repos.events.EventsRepository.$r8$lambda$rCh8eEPRaxVcqDhfqrbJl8XxBI8(Unknown Source:0)
at repos.events.EventsRepository$$ExternalSyntheticLambda12.call(Unknown Source:2)
at io.socket.emitter.Emitter.emit(Emitter.java:117)
at io.socket.client.Socket.onevent(Socket.java:363)
at io.socket.client.Socket.onpacket(Socket.java:307)
at io.socket.client.Socket.access$100(Socket.java:19)
at io.socket.client.Socket$2$2.call(Socket.java:92)
at io.socket.emitter.Emitter.emit(Emitter.java:117)
at io.socket.client.Manager.ondecoded(Manager.java:361)
at io.socket.client.Manager.access$1200(Manager.java:22)
at io.socket.client.Manager$5.call(Manager.java:355)
at io.socket.parser.IOParser$Decoder.add(IOParser.java:103)
at io.socket.client.Manager$2.call(Manager.java:331)
at io.socket.emitter.Emitter.emit(Emitter.java:117)
at io.socket.engineio.client.Socket.onPacket(Socket.java:556)
at io.socket.engineio.client.Socket.access$1000(Socket.java:29)
at io.socket.engineio.client.Socket$5.call(Socket.java:335)
at io.socket.emitter.Emitter.emit(Emitter.java:117)
at io.socket.engineio.client.Transport.onPacket(Transport.java:124)
at io.socket.engineio.client.Transport.onData(Transport.java:116)
at io.socket.engineio.client.transports.WebSocket.access$100(WebSocket.java:22)
at io.socket.engineio.client.transports.WebSocket$1$2.run(WebSocket.java:71)
at io.socket.thread.EventThread$2.run(EventThread.java:80)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
at java.lang.Thread.run(Thread.java:1012)
debugged the parseOddsOrFixture() method
null didn't come anywhere

Related

Package signed with unknown certificate(go/gsrlt)

Cant start maps acctivity I am getting package signed with unknown certificate(go/gsrlt)
2022-02-18 13:16:04.444 14198-14239/com.example.airservice W/ProtoDataStoreFlagStore: Unable to update local snapshot for com.google.android.libraries.consentverifier#com.example.airservice, may result in stale flags.
java.util.concurrent.ExecutionException: java.lang.SecurityException: GoogleCertificatesRslt: Package signed with unknown certificate (go/gsrlt)
at ago.s(:com.google.android.gms.dynamite_mapsdynamite#214815052#21.48.15 (040700-0):3)
at ago.get(:com.google.android.gms.dynamite_mapsdynamite#214815052#21.48.15 (040700-0):2)
at ais.a(:com.google.android.gms.dynamite_mapsdynamite#214815052#21.48.15 (040700-0):1)
at ahy.g(:com.google.android.gms.dynamite_mapsdynamite#214815052#21.48.15 (040700-0):1)
at wx.e(:com.google.android.gms.dynamite_mapsdynamite#214815052#21.48.15 (040700-0):1)
at ye.run(:com.google.android.gms.dynamite_mapsdynamite#214815052#21.48.15 (040700-0):0)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Caused by: java.lang.SecurityException: GoogleCertificatesRslt: Package signed with unknown certificate (go/gsrlt)
at android.os.Parcel.readException(Parcel.java:1684)
at android.os.Parcel.readException(Parcel.java:1637)
at ee.aZ(:com.google.android.gms.dynamite_mapsdynamite#214815052#21.48.15 (040700-0):2)
at qu.a(:com.google.android.gms.dynamite_mapsdynamite#214815052#21.48.15 (040700-0):4)
at ik.e(:com.google.android.gms.dynamite_mapsdynamite#214815052#21.48.15 (040700-0):2)
at jj.t(:com.google.android.gms.dynamite_mapsdynamite#214815052#21.48.15 (040700-0):2)
at jj.u(:com.google.android.gms.dynamite_mapsdynamite#214815052#21.48.15 (040700-0):3)
at jj.e(:com.google.android.gms.dynamite_mapsdynamite#214815052#21.48.15 (040700-0):2)
at jn.handleMessage(:com.google.android.gms.dynamite_mapsdynamite#214815052#21.48.15 (040700-0):69)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:154)
at android.os.HandlerThread.run(HandlerThread.java:61)

java.net.ConnectException: Failed to connect to /10.191.20.97:8080

I have connect java REST on local my computer(10.191.20.97:8080) I am making a android login app that is connecting to Java server. from browser i have successful connection with server but with android studio is somethings wrong:
I/System.out: port:8080
W/System.err: java.net.ConnectException: Failed to connect to /10.191.20.97:8080
W/System.err: at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:143)
at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:112)
at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:184)
at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126)
W/System.err: at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:299)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:237)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:461)
W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:127)
W/System.err: at com.hpi.android.assetmanagement.ui.updateapk.MainCheckVersion$1GetDataJSON.doInBackground(MainCheckVersion.java:358)
W/System.err: at com.hpi.android.assetmanagement.ui.updateapk.MainCheckVersion$1GetDataJSON.doInBackground(MainCheckVersion.java:334)
W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:333)
W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
E/Internet: => false
D/WindowClient: Add to mViews: DecorView#d78cc18[], this = android.view.WindowManagerGlobal#3577954
D/ViewRootImpl[MainCheckVersion]: hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false
I/zygote: Do full code cache collection, code=252KB, data=207KB
I/zygote: After code cache collection, code=252KB, data=176KB
D/Surface: Surface::connect(this=0x8f824000,api=1)
D/Surface: Surface::allocateBuffers(this=0x8f824000)
D/Surface: Surface::disconnect(this=0x8f823000,api=1)
D/Surface: Surface::connect(this=0x8f823000,api=1)
D/Surface: Surface::disconnect(this=0x8f823000,api=1)
D/View: [Warning] assignParent to null: this = DecorView#67cfdda[]
D/WindowClient: Remove from mViews: DecorView#67cfdda[], this = android.view.WindowManagerGlobal#3577954

java.lang.RuntimeException: Failure delivering result ResultInfo{...} to activity {....FacebookSignUp}: java.lang.NullPointerException:

In the Google Play Console pre-launch report, I the "STABILITY" section, I have this error that I need to fix:
Galaxy S9
Test ID: 2
Test Duration: 300 seconds
Model Name: Galaxy S9
Manufacturer: Samsung
Android Version: Android 8.0
Locale: es_US
Screen Size: 1080 × 2220
Screen Density (dpi): 480
RAM: 4096 MB
OpenGL ES Version: 3.2
Native Platform: armeabi-v7a
CPU Make: Qualcomm
CPU Model: SDM845
Issue: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=32665, result=0, data=null} to activity {[...].FacebookSignUp}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getStringExtra(java.lang.String)' on a null object reference
FATAL EXCEPTION: main
Process: [...], PID: 25180
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=32665, result=0, data=null} to activity {[...].FacebookSignUp}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getStringExtra(java.lang.String)' on a null object reference
at android.app.ActivityThread.deliverResults(ActivityThread.java:4489)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4532)
at android.app.ActivityThread.-wrap20(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1752)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getStringExtra(java.lang.String)' on a null object reference
at com.easy.facebook.android.facebook.FBLoginManager.loginSuccess(FBLoginManager.java:99)
at [...].FacebookSignUp.onActivityResult(FacebookSignUp.java:187)
at android.app.Activity.dispatchActivityResult(Activity.java:7539)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4485)
... 9 more
I suspect that this problem might be happening because my Facebook library is too old. In my app/build.gradle I am using this Facebook library:
implementation 'com.facebook.android:facebook-android-sdk:3.23.1'
I am sure it is very old and most likely deprecated in many ways. It still works though, but it might be the cause of this error that I see. Also, I am using this:
dependencies {
...
implementation files('libs/easyfacebookandroidsdk_2.3.jar')
....
}
That Facebook library must be the cause. Any ideas about fixing that NullPointerException that I see in the error? I guess the best should be for me to upgrade those very old Facebook libraries.
The problem was not Facebook. After examining the logs, the real problem was this:
E/AndroidRuntime: FATAL EXCEPTION: Thread-6
Process: [package name], PID: 5893
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/impl/client/DefaultHttpClient;
at com.couponclub.Util.Util$1.run(Util.java:235)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.impl.client.DefaultHttpClient" on path: DexPathList[[zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/base.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_dependencies_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_resources_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_0_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_1_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_2_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_3_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_4_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_5_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_6_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_7_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_8_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.couponclub.Util.Util$1.run(Util.java:235)
at java.lang.Thread.run(Thread.java:764)
Suppressed: java.io.IOException: No original dex files found for dex location /data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_resources_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:354)
at dalvik.system.DexFile.<init>(DexFile.java:101)
at dalvik.system.DexFile.<init>(DexFile.java:75)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:394)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:354)
at dalvik.system.DexPathList.<init>(DexPathList.java:164)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:74)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:74)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:40)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:727)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:810)
at android.app.LoadedApk.getResources(LoadedApk.java:1032)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2345)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5749)
at android.app.ActivityThread.access$1100(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
The solution was to go include the following line inside of the <application> section of my AndroidManifest.xml:
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
This is explained at https://developer.android.com/about/versions/pie/android-9.0-changes-28#apache-p.

Azure create multiple VMs in parallel fails

I am using this sample
https://github.com/azure-samples/compute-java-manage-virtual-machines-in-parallel
It works fine with VM number 5.
However, specifying number of VMs 17 or 33 it fails with the number of exceptions equal to number of VMs that were failed to be created (some of them are created). No good error message is returned. What may be the error?
I am getting log like this
[RxIoScheduler-22] INFO com.microsoft.azure.management.compute.VirtualMachines createOrUpdate - <-- 409 Conflict https://management.azure.com/subscriptions/.../resourceGroups/rgcoppc3834913a3950/providers/Microsoft.Compute/virtualMachines/VM-19?api-version=2016-04-30-preview (1815 ms, 195-byte body)
[RxIoScheduler-21] INFO com.microsoft.azure.management.compute.VirtualMachines createOrUpdate - <-- 409 Conflict https://management.azure.com/subscriptions/.../resourceGroups/rgcoppc3834913a3950/providers/Microsoft.Compute/virtualMachines/VM-30?api-version=2016-04-30-preview (1893 ms, 195-byte body)
[RxIoScheduler-6] INFO com.microsoft.azure.management.compute.VirtualMachines createOrUpdate - <-- 409 Conflict https://management.azure.com/subscriptions/..../resourceGroups/rgcoppc3834913a3950/providers/Microsoft.Compute/virtualMachines/VM-10?api-version=2016-04-30-preview (2096 ms, 195-byte body)
Stacktrace example (33 VMs, some not created):
31 exceptions occurred.
rx.exceptions.CompositeException: 31 exceptions occurred.
at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:268)
at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:658)
at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)
at rx.internal.operators.OperatorMerge$InnerSubscriber.onCompleted(OperatorMerge.java:857)
at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:656)
at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onCompleted(OperatorMerge.java:281)
at rx.internal.operators.OperatorMapNotification$MapNotificationSubscriber.tryEmit(OperatorMapNotification.java:155)
at rx.internal.operators.OperatorMapNotification$MapNotificationSubscriber.onCompleted(OperatorMapNotification.java:121)
at rx.internal.operators.OnSubscribeDoOnEach$DoOnEachSubscriber.onCompleted(OnSubscribeDoOnEach.java:70)
at rx.internal.operators.OperatorSubscribeOn$1$1.onCompleted(OperatorSubscribeOn.java:68)
at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:656)
at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onCompleted(OperatorMerge.java:281)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onCompleted(OnSubscribeMap.java:97)
at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:656)
at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)
at rx.internal.operators.OperatorMerge$InnerSubscriber.onCompleted(OperatorMerge.java:857)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onCompleted(OnSubscribeMap.java:97)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onCompleted(OnSubscribeMap.java:97)
at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:656)
at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)
at rx.internal.operators.OperatorMerge$InnerSubscriber.onCompleted(OperatorMerge.java:857)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onCompleted(OnSubscribeMap.java:97)
at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:656)
at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onCompleted(OperatorMerge.java:281)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onCompleted(OnSubscribeMap.java:97)
at rx.internal.producers.SingleProducer.request(SingleProducer.java:75)
at rx.Subscriber.setProducer(Subscriber.java:211)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.setProducer(OnSubscribeMap.java:102)
at rx.internal.operators.OperatorSingle$ParentSubscriber.onCompleted(OperatorSingle.java:110)
at rx.internal.operators.OperatorTake$1.onNext(OperatorTake.java:80)
at rx.internal.operators.OnSubscribeFilter$FilterSubscriber.onNext(OnSubscribeFilter.java:76)
at rx.internal.operators.OperatorMerge$MergeSubscriber.emitScalar(OperatorMerge.java:395)
at rx.internal.operators.OperatorMerge$MergeSubscriber.tryEmit(OperatorMerge.java:355)
at rx.internal.operators.OperatorMerge$InnerSubscriber.onNext(OperatorMerge.java:846)
at rx.internal.operators.OperatorMerge$MergeSubscriber.emitScalar(OperatorMerge.java:511)
at rx.internal.operators.OperatorMerge$MergeSubscriber.tryEmit(OperatorMerge.java:466)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:244)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:148)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77)
at rx.internal.operators.OperatorMerge$MergeSubscriber.emitScalar(OperatorMerge.java:511)
at rx.internal.operators.OperatorMerge$MergeSubscriber.tryEmit(OperatorMerge.java:466)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:244)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:148)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77)
at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$RequestArbiter.request(RxJavaCallAdapterFactory.java:173)
at rx.Subscriber.setProducer(Subscriber.java:211)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.setProducer(OnSubscribeMap.java:102)
at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:152)
at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:138)
at rx.Observable.unsafeSubscribe(Observable.java:10142)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.unsafeSubscribe(Observable.java:10142)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.unsafeSubscribe(Observable.java:10142)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:248)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:148)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77)
at rx.internal.operators.OnSubscribeRedo$2$1.onNext(OnSubscribeRedo.java:244)
at rx.internal.util.ScalarSynchronousObservable$ScalarAsyncProducer.call(ScalarSynchronousObservable.java:200)
at rx.internal.util.ScalarSynchronousObservable$2$1.call(ScalarSynchronousObservable.java:114)
at rx.internal.schedulers.CachedThreadScheduler$EventLoopWorker$1.call(CachedThreadScheduler.java:230)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
ComposedException 1 :
com.microsoft.azure.CloudException
at com.microsoft.azure.AzureClient.createExceptionFromResponse(AzureClient.java:591)
at com.microsoft.azure.AzureClient.access$000(AzureClient.java:34)
at com.microsoft.azure.AzureClient$1.call(AzureClient.java:135)
at com.microsoft.azure.AzureClient$1.call(AzureClient.java:132)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:69)
at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$RequestArbiter.request(RxJavaCallAdapterFactory.java:173)
at rx.Subscriber.setProducer(Subscriber.java:211)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.setProducer(OnSubscribeMap.java:102)
at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:152)
at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:138)
at rx.Observable.unsafeSubscribe(Observable.java:10142)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.unsafeSubscribe(Observable.java:10142)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.Observable.unsafeSubscribe(Observable.java:10142)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.Observable.unsafeSubscribe(Observable.java:10142)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:248)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:148)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77)
at rx.internal.util.ScalarSynchronousObservable$WeakSingleProducer.request(ScalarSynchronousObservable.java:276)
at rx.Subscriber.setProducer(Subscriber.java:211)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.setProducer(OnSubscribeMap.java:102)
Java Azure SDK should be more helpful at providing meaningful error messages.
In Web Azure interface go to "Events" page. There you will find failure logs.
Messages there are still not very helpful but then Google for them.
I found that every region and/or subscription has quotas
https://learn.microsoft.com/en-us/azure/azure-subscription-service-limits
Here are typical errors:
https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-common-deployment-errors#quotaexceeded
You should issue support request to increase quota:
https://blogs.msdn.microsoft.com/girishp/2015/09/20/increasing-core-quota-limits-in-azure/

Android app keeps crashing on emulator and device [duplicate]

This question already has answers here:
What is a NullPointerException, and how do I fix it?
(12 answers)
Closed 3 years ago.
I am executing a very basic task of opening another activity using a button. The code seems to be error-free but the app crashes without even showing the main activity. This happens on both the emulator as well as my device.
When the app has no function, i.e. when the app has just buttons which do nothing, the app works fine. But if I try to make them do anything(intent to open another activity, or to play with their visibility) the app crashes.
The logcat is as follows:
11-12 13:55:56.627 2962-2962/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
11-12 13:55:56.628 2962-2962/? D/AndroidRuntime: CheckJNI is ON
11-12 13:55:56.672 2962-2962/? D/ICU: No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
11-12 13:55:56.754 2962-2962/? E/memtrack: Couldn't load memtrack module (No such file or directory)
11-12 13:55:56.754 2962-2962/? E/android.os.Debug: failed to load memtrack module: -2
11-12 13:55:56.755 2962-2962/? I/Radio-JNI: register_android_hardware_Radio DONE
11-12 13:55:56.761 2962-2962/? D/AndroidRuntime: Calling main entry com.android.commands.pm.Pm
11-12 13:55:56.772 2962-2962/? I/art: System.exit called, status: 0
11-12 13:55:56.772 2962-2962/? I/AndroidRuntime: VM exiting with result code 0.
11-12 13:55:57.068 2977-2977/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
11-12 13:55:57.069 2977-2977/? D/AndroidRuntime: CheckJNI is ON
11-12 13:55:57.129 2977-2977/? D/ICU: No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
11-12 13:55:57.199 2977-2977/? E/memtrack: Couldn't load memtrack module (No such file or directory)
11-12 13:55:57.199 2977-2977/? E/android.os.Debug: failed to load memtrack module: -2
11-12 13:55:57.200 2977-2977/? I/Radio-JNI: register_android_hardware_Radio DONE
11-12 13:55:57.205 2977-2977/? D/AndroidRuntime: Calling main entry com.android.commands.pm.Pm
11-12 13:55:57.216 2977-2977/? I/art: System.exit called, status: 0
11-12 13:55:57.220 2977-2977/? I/AndroidRuntime: VM exiting with result code 0.
11-12 13:55:59.484 2987-2987/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
11-12 13:55:59.487 2987-2987/? D/AndroidRuntime: CheckJNI is ON
11-12 13:55:59.522 2987-2987/? D/ICU: No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
11-12 13:55:59.602 2987-2987/? E/memtrack: Couldn't load memtrack module (No such file or directory)
11-12 13:55:59.602 2987-2987/? E/android.os.Debug: failed to load memtrack module: -2
11-12 13:55:59.603 2987-2987/? I/Radio-JNI: register_android_hardware_Radio DONE
11-12 13:55:59.615 2987-2987/? D/AndroidRuntime: Calling main entry com.android.commands.wm.Wm
11-12 13:55:59.643 2987-2987/? D/AndroidRuntime: Shutting down VM
11-12 13:56:01.407 2999-2999/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
11-12 13:56:01.408 2999-2999/? D/AndroidRuntime: CheckJNI is ON
11-12 13:56:01.465 2999-2999/? D/ICU: No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
11-12 13:56:01.542 2999-2999/? E/memtrack: Couldn't load memtrack module (No such file or directory)
11-12 13:56:01.542 2999-2999/? E/android.os.Debug: failed to load memtrack module: -2
11-12 13:56:01.543 2999-2999/? I/Radio-JNI: register_android_hardware_Radio DONE
11-12 13:56:01.553 2999-2999/? D/AndroidRuntime: Calling main entry com.android.commands.am.Am
--------- beginning of system
11-12 13:56:01.562 1585-1920/system_process I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.dell.crash/.MainActivity} from uid 0 on display 0
11-12 13:56:01.579 2147-2341/com.google.android.googlequicksearchbox:search I/MicrophoneInputStream: mic_close com.google.android.apps.gsa.speech.audio.u#20f33e2
11-12 13:56:01.605 3007-3007/? I/art: Not late-enabling -Xcheck:jni (already on)
11-12 13:56:01.606 2147-2347/com.google.android.googlequicksearchbox:search I/HotwordRecognitionRnr: Stopping hotword detection.
11-12 13:56:01.606 2147-2699/com.google.android.googlequicksearchbox:search I/HotwordRecognitionRnr: Hotword detection finished
11-12 13:56:01.610 1585-1598/system_process I/ActivityManager: Start proc 3007:com.example.dell.crash/u0a64 for activity com.example.dell.crash/.MainActivity
11-12 13:56:01.604 2999-2999/? D/AndroidRuntime: Shutting down VM
[ 11-12 13:56:01.697 1585: 1608 D/ ]
HostConnection::get() New Host Connection established 0x7f8480e69e40, tid 1608
11-12 13:56:01.728 3007-3007/com.example.dell.crash W/System: ClassLoader referenced unknown path: /data/app/com.example.dell.crash-1/lib/x86_64
11-12 13:56:01.729 3007-3007/com.example.dell.crash I/InstantRun: Instant Run Runtime started. Android package is com.example.dell.crash, real application class is null.
11-12 13:56:02.906 1891-2316/com.google.android.googlequicksearchbox E/Surface: getSlotFromBufferLocked: unknown buffer: 0xe9e5e990
11-12 13:56:03.510 3007-3007/com.example.dell.crash W/System: ClassLoader referenced unknown path: /data/app/com.example.dell.crash-1/lib/x86_64
11-12 13:56:03.707 3007-3007/com.example.dell.crash D/AndroidRuntime: Shutting down VM
--------- beginning of crash
11-12 13:56:03.707 3007-3007/com.example.dell.crash E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.dell.crash, PID: 3007
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.dell.crash/com.example.dell.crash.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.Window$Callback android.view.Window.getCallback()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2327)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
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)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.Window$Callback android.view.Window.getCallback()' on a null object reference
at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:116)
at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:147)
at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:27)
at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:50)
at android.support.v7.app.AppCompatDelegateImplV23.<init>(AppCompatDelegateImplV23.java:29)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:199)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:181)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:521)
at android.support.v7.app.AppCompatActivity.findViewById(AppCompatActivity.java:190)
at com.example.dell.crash.MainActivity.<init>(MainActivity.java:10)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1067)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2317)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
at android.app.ActivityThread.-wrap11(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
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) 
11-12 13:56:03.708 1585-2055/system_process W/ActivityManager: Force finishing activity com.example.dell.crash/.MainActivity
11-12 13:56:04.016 1585-2055/system_process I/WindowManager: Screenshot max retries 4 of Token{9795bf6 ActivityRecord{989c091 u0 com.example.dell.crash/.MainActivity t51 f}} appWin=Window{a3bf3ce u0 Starting com.example.dell.crash} drawState=4
11-12 13:56:04.116 1585-2485/system_process I/OpenGLRenderer: Initialized EGL, version 1.4
11-12 13:56:04.518 1585-1601/system_process W/ActivityManager: Activity pause timeout for ActivityRecord{989c091 u0 com.example.dell.crash/.MainActivity t51 f}
11-12 13:56:04.550 2328-2336/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/com.google.android.gms/databases/networkstatistics.sqlite' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
11-12 13:56:04.550 2328-2336/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/com.google.android.gms/databases/metrics.db' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
11-12 13:56:04.551 2328-2336/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/com.google.android.gms/databases/help_responses.db' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
11-12 13:56:04.572 2328-2336/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/com.google.android.gms/databases/auto_complete_suggestions.db' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
11-12 13:56:04.860 1585-1602/system_process I/Choreographer: Skipped 35 frames! The application may be doing too much work on its main thread.
11-12 13:56:04.925 2147-3076/com.google.android.googlequicksearchbox:search I/HotwordRecognitionRnr: Starting hotword detection.
11-12 13:56:04.943 2147-3078/com.google.android.googlequicksearchbox:search I/MicrophoneInputStream: mic_starting com.google.android.apps.gsa.speech.audio.u#76753fd
11-12 13:56:04.955 1585-1599/system_process I/ActivityManager: Killing 2527:com.android.settings/1000 (adj 15): empty #17
11-12 13:56:04.965 1202-2042/? E/audio_hw_generic: Error opening input stream format 1, channel_mask 0010, sample_rate 16000
11-12 13:56:04.969 1202-3080/? I/AudioFlinger: AudioFlinger's thread 0xf3b80000 ready to run
11-12 13:56:04.988 2147-3078/com.google.android.googlequicksearchbox:search I/MicrophoneInputStream: mic_started com.google.android.apps.gsa.speech.audio.u#76753fd
11-12 13:56:04.991 2147-2341/com.google.android.googlequicksearchbox:search I/MicrophoneInputStream: mic_close com.google.android.apps.gsa.speech.audio.u#76753fd
11-12 13:56:04.992 2147-3078/com.google.android.googlequicksearchbox:search E/AudioRecord-JNI: Error -4 during AudioRecord native read
11-12 13:56:05.009 2147-2347/com.google.android.googlequicksearchbox:search I/HotwordRecognitionRnr: Stopping hotword detection.
11-12 13:56:05.010 2147-3076/com.google.android.googlequicksearchbox:search I/HotwordRecognitionRnr: Hotword detection finished
11-12 13:56:05.140 1585-1599/system_process I/ActivityManager: Killing 2649:com.android.dialer/u0a4 (adj 15): empty #17
11-12 13:56:05.395 1891-2316/com.google.android.googlequicksearchbox W/OpenGLRenderer: Incorrectly called buildLayer on View: em, destroying layer...
11-12 13:56:05.447 1585-1608/system_process D/gralloc_ranchu: gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread)
11-12 13:56:05.466 2328-2472/com.google.android.gms I/Icing: Usage reports 0 indexed 0 rejected 0 imm upload true
11-12 13:56:05.486 2328-2504/com.google.android.gms I/Icing: Usage reports 0 indexed 0 rejected 0 imm upload true
11-12 13:56:05.499 1585-1920/system_process I/ActivityManager: Killing 2670:com.android.managedprovisioning/u0a8 (adj 15): empty #17
11-12 13:56:15.034 1585-1601/system_process W/ActivityManager: Activity destroy timeout for ActivityRecord{989c091 u0 com.example.dell.crash/.MainActivity t51 f}
11-12 13:56:15.075 2147-3230/com.google.android.googlequicksearchbox:search W/CronetSyncConnectionRcs: Upload content type not set.
11-12 13:56:17.062 3007-3007/com.example.dell.crash I/Process: Sending signal. PID: 3007 SIG: 9
11-12 13:56:17.093 1585-2485/system_process E/Surface: getSlotFromBufferLocked: unknown buffer: 0x7f849297e160
11-12 13:56:17.101 1585-2485/system_process D/OpenGLRenderer: endAllStagingAnimators on 0x7f84835bfc00 (RippleDrawable) with handle 0x7f847ee9ee60
11-12 13:56:17.131 1585-1920/system_process W/InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#9d97b24 attribute=null, token = android.os.BinderProxy#32922a9
11-12 13:56:17.165 1585-1920/system_process I/ActivityManager: Process com.example.dell.crash (pid 3007) has died
11-12 13:56:17.367 1585-1608/system_process W/AppOps: Finishing op nesting under-run: uid 1000 pkg android code 24 time=0 duration=0 nesting=0
11-12 13:56:17.409 2147-3268/com.google.android.googlequicksearchbox:search I/HotwordRecognitionRnr: Starting hotword detection.
11-12 13:56:17.413 2147-3269/com.google.android.googlequicksearchbox:search I/MicrophoneInputStream: mic_starting com.google.android.apps.gsa.speech.audio.u#898b349
11-12 13:56:17.423 1202-1546/? E/audio_hw_generic: Error opening input stream format 1, channel_mask 0010, sample_rate 16000
11-12 13:56:17.444 1202-3273/? I/AudioFlinger: AudioFlinger's thread 0xf3b80000 ready to run
11-12 13:56:17.449 2147-2157/com.google.android.googlequicksearchbox:search I/art: Background sticky concurrent mark sweep GC freed 1466(93KB) AllocSpace objects, 0(0B) LOS objects, 9% free, 4MB/4MB, paused 25.294ms total 31.038ms
11-12 13:56:17.456 2147-3269/com.google.android.googlequicksearchbox:search I/MicrophoneInputStream: mic_started com.google.android.apps.gsa.speech.audio.u#898b349
11-12 13:56:17.493 2147-2147/com.google.android.googlequicksearchbox:search I/HotwordWorker: onReady
11-12 13:56:17.504 2328-3272/com.google.android.gms W/IcingInternalCorpora: getNumBytesRead when not calculated.
11-12 13:56:17.564 2328-2472/com.google.android.gms I/Icing: Usage reports 0 indexed 0 rejected 0 imm upload true
11-12 13:56:17.571 2328-2472/com.google.android.gms I/Icing: Usage reports 0 indexed 0 rejected 0 imm upload true
11-12 13:56:18.155 1202-1544/? W/AudioFlinger: write blocked for 408 msecs, 4 delayed writes, thread 0xf4500000
The .java file has the following block:
public class MainActivity extends AppCompatActivity {
Button btn1 = (Button) findViewById(R.id.button);
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
startActivity(new Intent(MainActivity.this, Main2Activity.class));
}
});
}
}
The XML file is as follows:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.dell.crash.MainActivity">
<Button
android:text="Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="102dp"
android:id="#+id/button" />
</RelativeLayout>
I am using Android Studio 2.2.2
After
setContentView(R.layout.activity_main);
Add call like this
Button button = (Button) findViewById(R.id.button);
issue was you didn't created reference for button.
put Button btn1 = (Button) findViewById(R.id.button); in oncreate method.
The reason is you try add an event to your button but didn't show the reference id inside oncreate from where every app start its activity.
You should always instantiate button inside onCreate(). So your code should be like
public class MainActivity extends AppCompatActivity {
Button btn1;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn1 = (Button) findViewById(R.id.button);
btn1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
startActivity(new Intent(MainActivity.this, Main2Activity.class));
}
});
}
}
If you init your btn1 variable in declarations section, it will run before the setContextView(...) function call. Put btn1 initialization after setContextView(...)!
public class MainActivity extends AppCompatActivity {
private Button btn1;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn1 = Button.class.cast(findViewById(R.id.button));
btn1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
startActivity(new Intent(MainActivity.this, Main2Activity.class));
}
});
}
}

Categories