I've been storing my project in DropBox to share across computers so I can work from my laptop upstairs. Everything worked fine on my PC, then I went and loaded the project on my laptop and it just crashed when I tried to run it so I gave up and came back to my PC, but now it isn't working there either. It was working fine, I didn't change anything about the code at all. but now I get the error below.
No matter how many gradle syncs and updates and everything that I try I can't figure out how to fix. In addition to fixing this, how am I supposed to work on the same project on multiple PC's without breaking everything?
I ran a Gradle Clean and Sync but it didn't seem to work that time either. Also I didn't even realize I was using AsyncTask, so I'll look at that.
Since I'm not sure exactly what the stack trace is, here's my whole LogCat :)
03-10 14:25:41.849 4830-4830/com.mydomain.myapp W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
03-10 14:25:41.960 4830-4830/com.mydomain.myapp I/TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead.
03-10 14:25:41.961 4830-4830/com.mydomain.myapp I/TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead.
03-10 14:25:41.966 4830-4870/com.mydomain.myapp V/FA: Using measurement service
03-10 14:25:41.966 4830-4870/com.mydomain.myapp V/FA: Connecting to remote service
03-10 14:25:41.967 4830-4870/com.mydomain.myapp V/FA: Activity resumed, time: 4313744
03-10 14:25:41.977 4830-5248/com.mydomain.myapp E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.mydomain.myapp, PID: 4830
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{36fd80a 4830:com.mydomain.myapp/u0a17} (pid=4830, uid=10017) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS
at android.os.Parcel.readException(Parcel.java:1599)
at android.os.Parcel.readException(Parcel.java:1552)
at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:3550)
at android.app.ActivityThread.acquireProvider(ActivityThread.java:4778)
at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2018)
at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1468)
at android.content.ContentResolver.query(ContentResolver.java:475)
at android.content.CursorLoader.loadInBackground(CursorLoader.java:64)
at android.content.CursorLoader.loadInBackground(CursorLoader.java:56)
at android.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:312)
at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:69)
at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:66)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
03-10 14:25:41.980 4830-5250/com.mydomain.myapp D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
[ 03-10 14:25:41.982 4830: 4830 D/ ]
HostConnection::get() New Host Connection established 0x7effab5dc260, tid 4830
03-10 14:25:42.283 4830-4830/com.mydomain.myapp D/MainActivity: onAuthStateChanged:signed_out
03-10 14:25:42.314 4830-5250/com.mydomain.myapp I/OpenGLRenderer: Initialized EGL, version 1.4
03-10 14:25:42.314 4830-5250/com.mydomain.myapp W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
03-10 14:25:42.434 4830-4870/com.mydomain.myapp V/FA: Screen exposed for less than 1000 ms. Event not sent. time: 469
03-10 14:25:42.435 4830-4870/com.mydomain.myapp V/FA: Using measurement service
03-10 14:25:42.435 4830-4870/com.mydomain.myapp V/FA: Connection attempt already in progress
03-10 14:25:42.436 4830-4870/com.mydomain.myapp V/FA: Activity paused, time: 4314214
03-10 14:25:42.457 4830-4870/com.mydomain.myapp D/FA: Connected to remote service
03-10 14:25:42.457 4830-4870/com.mydomain.myapp V/FA: Processing queued up service tasks: 2
03-10 14:25:42.526 4830-4830/com.mydomain.myapp W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
03-10 14:25:42.640 4830-5250/com.mydomain.myapp E/Surface: getSlotFromBufferLocked: unknown buffer: 0x7effa40972a0
First thing, on the original computer on which this project last worked, try a gradle 'clean' and then a build. If that doesn't work, it probably means that you changed the code since it last worked. Try to figure out what you changed, and undo that.
Second, AsyncTask is the source of a lot of headaches (and crashes), because it holds a reference to the Activity from which it was started, but is not part of the Activity's lifecycle, so can operate on the Activity after the Activity has been destroyed. My suggestion - don't use AsyncTask - regardless of what you are using it for, there is almost always a better way. Post your stacktrace here, and we might be able to help you figure out what the problem is.
As far as sharing code, use a version control system. GitHub is good, and it's free. Proper use of it would also let you easily roll your code back to the point where it last worked.
=====
Ok, so looking at the stacktrace that you posted from your logcat, we see:
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) at java.util.concurrent.FutureTask.setException(FutureTask.java:223) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{36fd80a 4830:com.mydomain.myapp/u0a17} (pid=4830, uid=10017) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS
So, it looks like you are attempting to access the ContactsProvider, but haven't put the READ_CONTACTS permission in your manifest.
Related
I've been trying to integrate Facebook ads in my app for Android with the audience-network-sdk:5.0.0 and Facebook sdk crashed with this error:
10-16 13:12:07.128 25301-25725/? D/ProxyCache: Open connection to http://127.0.0.1:43557/ping
10-16 13:12:08.318 25301-25586/? E/ProxyCache: Error pinging server [attempt: 2, timeout: 1200].
java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(FutureTask.java:176)
at com.facebook.ads.internal.r.b.f.b(Unknown Source)
at com.facebook.ads.internal.r.b.f.<init>(Unknown Source)
at com.facebook.ads.internal.r.b.f.<init>(Unknown Source)
at com.facebook.ads.internal.f.d$1.a(Unknown Source)
at com.facebook.ads.internal.f.d$1.call(Unknown Source)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Shutdown server... Error pinging server [attempts: 3, max timeout: 1200].
10-16 13:12:08.318 25301-25586/? I/ProxyCache: Shutdown proxy server
10-16 13:12:08.328 25301-25602/? W/System.err: java.lang.InterruptedException
10-16 13:12:08.348 25301-25602/? W/System.err: at java.lang.Thread.sleep(Native Method)
at java.lang.Thread.sleep(Thread.java:1031)
at java.lang.Thread.sleep(Thread.java:985)
at com.splunk.mint.ExceptionHandler.uncaughtException(ExceptionHandler.java:64)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
10-16 13:12:08.348 25301-25602/? E/AndroidRuntime: FATAL EXCEPTION: Thread-12294
PID: 25301
java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io.FileDescriptor.setInt$(int)' on a null object reference
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:93)
at java.net.ServerSocket.implAccept(ServerSocket.java:216)
at java.net.ServerSocket.accept(ServerSocket.java:140)
at com.facebook.ads.internal.r.b.f.e(Unknown Source)
at com.facebook.ads.internal.r.b.f.a(Unknown Source)
at com.facebook.ads.internal.r.b.f$e.run(Unknown Source)
at java.lang.Thread.run(Thread.java:818)
As you can see the trace just tell you that the ping (and the connection to local host) failed but it doesn't tell you more. I am not solving it because it only happens in physical device and only with my app (the example app from Facebook runs great in the same device and same network).
I don't know why is happening and how to fix it.
So I finally found the error and the solution.
Let me explain the error:
Facebook ads SDK uses localhost Proxy cache to download the assets of the ads
I also use Splunk Mint to track errors of my app in production.
Splunk Mint library has issues with the http monitoring:
Disable network monitoring
The solution was to add this line before init Mint SDK:
Mint.disableNetworkMonitoring();
Application worked on this emulator, I have tried to implement Google Play Game services and it appears that this service can't connect. I have tried on multiple emulators. Now when I run the app all I get is the black screen.
Here is the Android Monitor:
09-18 13:11:28.507 1141-1141/? E/Drm: Failed to open plugin directory /vendor/lib/mediadrm
09-18 13:11:29.897 1963-8847/com.google.android.gms E/ChromeSync: [Sync,SyncAdapter] Failed to sync.
hlr: Error when calling the server (message: Application credential header not valid. Please fix the client to pass a valid application credential header.).
at hlt.b(:com.google.android.gms:11)
at hmd.c(:com.google.android.gms:1)
at hmh.b(:com.google.android.gms:61)
at hmf.a(:com.google.android.gms:12)
at jlo.onPerformSync(:com.google.android.gms:2)
at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:259)
Caused by: aury: INVALID_ARGUMENT: Application credential header not valid. Please fix the client to pass a valid application credential header.
at auru.c(:com.google.android.gms:2)
at jgq.a(:com.google.android.gms:62)
at hlt.b(:com.google.android.gms:9)
at hmd.c(:com.google.android.gms:1)
at hmh.b(:com.google.android.gms:61)
at hmf.a(:com.google.android.gms:12)
at jlo.onPerformSync(:com.google.android.gms:2)
at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:259)
09-18 13:11:41.977 8863-8863/? E/memtrack: Couldn't load memtrack module (No such file or directory)
09-18 13:11:41.977 8863-8863/? E/android.os.Debug: failed to load memtrack module: -2
09-18 13:11:42.887 1963-1972/com.google.android.gms E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
java.lang.Throwable: Explicit termination method 'close' not called
at dalvik.system.CloseGuard.open(CloseGuard.java:184)
at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:179)
at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:168)
at android.os.ParcelFileDescriptor.createPipe(ParcelFileDescriptor.java:362)
at com.google.android.gms.ads.internal.request.n.a(:com.google.android.gms:1)
at com.google.android.gms.ads.internal.request.n.writeToParcel(:com.google.android.gms:5)
at jdq.a(:com.google.android.gms:16)
at com.google.android.gms.ads.internal.request.d.writeToParcel(:com.google.android.gms:28)
at brr.a(:com.google.android.gms:6)
at com.google.android.gms.ads.internal.request.k.a(:com.google.android.gms:0)
at com.google.android.gms.ads.internal.request.service.i.run(:com.google.android.gms:7)
at com.google.android.gms.ads.internal.util.v.call(:com.google.android.gms:1)
at com.google.android.gms.ads.internal.util.w.run(:com.google.android.gms:0)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
09-18 13:11:42.957 1816-2482/com.google.process.gapps E/NetworkScheduler.SR: Unrecognised action provided: android.intent.action.PACKAGE_REMOVED
09-18 13:11:43.397 8903-8903/? E/memtrack: Couldn't load memtrack module (No such file or directory)
Also I tried to install signed apk to Emulator with adb install but the same problem appears.
Everytime I run the app, I get this error message. There is nothing in the app, it is just a basic Navigation drawer template you get in the studio. The message only appears on certain devices (I ran it on a Zenfone 2 with Lineage OS(7.1.1)). My SDK version is 25 and I'm running android studio 2.3.1.
The message says:
Detected problems with app native libraries (please consult log for details):
libavcodec.so: text relocations
libswresample.so: text relocations
Log:
04-08 21:53:06.321 6798-6798/? I/art: Late-enabling -Xcheck:jni
04-08 21:53:06.482 6798-6798/com.platformpetal.platformpetal W/System: ClassLoader referenced unknown path: /data/app/com.platformpetal.platformpetal-1/lib/x86
04-08 21:53:06.494 6798-6798/com.platformpetal.platformpetal I/InstantRun: starting instant run server: is main process
04-08 21:53:06.664 6798-6831/com.platformpetal.platformpetal I/OpenGLRenderer: Initialized EGL, version 1.4
04-08 21:53:06.664 6798-6831/com.platformpetal.platformpetal D/OpenGLRenderer: Swap behavior 1
04-08 21:53:06.665 6798-6831/com.platformpetal.platformpetal W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
04-08 21:53:06.665 6798-6831/com.platformpetal.platformpetal D/OpenGLRenderer: Swap behavior 0
04-08 21:53:08.704 6798-6798/com.platformpetal.platformpetal W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
04-08 21:53:09.158 6798-6798/com.platformpetal.platformpetal W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
04-08 21:53:09.598 6798-6798/com.platformpetal.platformpetal E/WindowManager: android.view.WindowLeaked: Activity com.platformpetal.platformpetal.SplashScreen has leaked window DecorView#aaf4c69[] that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:418)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:331)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:94)
at android.app.Dialog.show(Dialog.java:322)
at android.app.AlertDialog$Builder.show(AlertDialog.java:1112)
at android.app.Activity.performStart(Activity.java:6718)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2628)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6126)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776
)
Here the error message is for the activity being terminated before the message closes. There is nothing I can find which can cause the issue.
P.S. Stack Overflow doesn't allow word problem in question, so I wrote prob_lem
P.P.S. I'm relatively new to android, so don't be harsh :)
This is documented in https://developer.android.com/about/versions/nougat/android-7.0-changes.html#ndk => you need to bundle those .so files with your application, apparently.
For some reason my app won't call custom application classes onCreate() anymore. Yesterday everything was fine but today my app crashes when it tries to open a connection to Realm.
java.lang.IllegalStateException: Call 'Realm.init(Context)' before calling this method.
Since I do initialize Realm in my custom application classes onCreate() I tried inserting a breakpoint and logging out of the method. Nothing.
This question had a similiar problem
Custom Application class onCreate() never called
I have disabled instant run, cleaned, rebuilt and even restarted android studio but the problem persists. I even tried checking out a commit from three days ago, which was most certainly working, but the result is the same.
Custom application class
public class MyApplication extends Application
{
#Override
public void onCreate()
{
super.onCreate();
JodaTimeAndroid.init(this);
Realm.init(this);
//more Realm initialization code
}
}
Manifest's application section
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="#drawable/logo"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:supportsRtl="true"
android:theme="#style/MyTheme">
Any ideas what might cause this and how to get it fixed?
EDIT
Everything logcat puts out before crash
03-19 21:06:10.687 21869-21869/? E/Zygote: v2
03-19 21:06:10.687 21869-21869/? I/libpersona: KNOX_SDCARD checking this for 10323
03-19 21:06:10.687 21869-21869/? I/libpersona: KNOX_SDCARD not a persona
03-19 21:06:10.688 21869-21869/? E/Zygote: accessInfo : 0
03-19 21:06:10.688 21869-21869/? W/SELinux: SELinux selinux_android_compute_policy_index : Policy Index[2], Con:u:r:zygote:s0 RAM:SEPF_SECMOBILE_7.0_0004, [-1 -1 -1 -1 0 1]
03-19 21:06:10.689 21869-21869/? I/SELinux: SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=hailer.com.hailer
03-19 21:06:10.692 21869-21869/? I/art: Late-enabling -Xcheck:jni
03-19 21:06:10.709 21869-21869/? D/TimaKeyStoreProvider: TimaSignature is unavailable
03-19 21:06:10.709 21869-21869/? D/ActivityThread: Added TimaKeyStore provider
03-19 21:06:10.790 21869-21869/hailer.com.hailer D/ContextRelationMgrBrdg: loadKlass() : caller=com.samsung.android.bridge.multiscreen.common.ContextRelationManagerBridge.<clinit>:28 android.app.LoadedApk.makeApplication:833
03-19 21:06:10.814 21869-21869/hailer.com.hailer W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
03-19 21:06:10.872 21869-21869/hailer.com.hailer D/AndroidRuntime: Shutting down VM
03-19 21:06:10.873 21869-21869/hailer.com.hailer E/AndroidRuntime: FATAL EXCEPTION: main
Process: hailer.com.hailer, PID: 21869
java.lang.RuntimeException: Unable to start activity ComponentInfo{hailer.com.hailer/hailer.com.hailer.activities.MainActivity}: java.lang.IllegalStateException: Call `Realm.init(Context)` before calling this method.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2947)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3008)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6688)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
Caused by: java.lang.IllegalStateException: Call `Realm.init(Context)` before calling this method.
at io.realm.Realm.getDefaultInstance(Realm.java:208)
at hailer.com.hailer.adapters.DiscussionAdapter.<init>(DiscussionAdapter.java:57)
at hailer.com.hailer.fragments.ChatListFragment.onCreateView(ChatListFragment.java:60)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2189)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1299)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:757)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2355)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2146)
at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2098)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2008)
at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:388)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:607)
at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178)
at hailer.com.hailer.activities.MainActivity.onStart(MainActivity.java:320)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1256)
at android.app.Activity.performStart(Activity.java:6929)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2910)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3008)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6688)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
UPDATE
I trimmed down the libraries and disabled multidexing. Didn't help. I also went trough the DiscussionAdapter and ChatListFragment and both are fine. Realm is used in a correct manner and has worked for over a year without issues. I also have log.d("CUSTOMAPPCLS","onCreate called") in my custom application class which does not show in the log. Nor does a breakpoint stop in any part of the onCreate() call.
Now I got a new error. This time it's from PrefsAccessor - a wrapper for SharedPreferences which is also intialised in the custom applications onCreate call. PrefAccessor.init(this); I ran the build again but got the Realm error... The one considering PrefAccessor threw a nullpointer execption when trying to access the SharedPreferences. This further points to the fact that the application onCreate isn't called.
public static string isUseEnterToSendEnabled()
{
SharedPreferences prefs = applicationContext.getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE);// <-- nullpointer exception: Trying to call .getSharedPreferences on a null object
return prefs.getBoolean(ENTER_TO_SEND, false);
}
I found similar scenario to yours here:
https://github.com/realm/realm-java/issues/1800
The issue seems to be about having lots of libraries included to your project (such as Google Play Services) which might led to your app hitting the 65K methods limit.
Did you include any new dependencies to your project?
UPDATE:
after checking your log, I believe the problem can be here:
hailer.com.hailer.adapters.DiscussionAdapter.(DiscussionAdapter.java:57)
at
hailer.com.hailer.fragments.ChatListFragment.onCreateView(ChatListFragment.java:60)
Maybe in your ChatListFragment, you have an instance of DiscussionAdapter which in turn has some static initializer that invokes something related to Realm.
UPDATE 04/2017
The Samsung S7 started working couple of days after I posted this answer... Black magics all the way I say.
It seems that the Samsung S7 that I usually use for testing is somehow busted. I got some other phones from the office and all of them work just fine. I really have no idea what caused the phone to start crashing the app... None of the other apps are crashing and I didn't download any updates or other apps before this started. I'll post a comment to this answer if I figure this one out and accept this as the solution since I found a "solution"....
Any help given at this stage will be appreciated, i have tried reading but now i am actually confused, The first time it was Calender i went and introduced an exception and that has gone away now i see it is mms How can i deal with this? any advice?
1895-1904/com.android.mms E/StrictMode﹕ A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
java.lang.Throwable: Explicit termination method 'release' not called
at dalvik.system.CloseGuard.open(CloseGuard.java:184)
at android.drm.DrmManagerClient.<init>(DrmManagerClient.java:258)
at com.google.android.mms.pdu.PduPersister.<init>(PduPersister.java:288)
at com.google.android.mms.pdu.PduPersister.getPduPersister(PduPersister.java:299)
at com.android.mms.transaction.TransactionService.onNewIntent(TransactionService.java:231)
at com.android.mms.transaction.TransactionService$ServiceHandler.handleMessage(TransactionService.java:633)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
1989-2046/com.android.email E/EmailServiceProxy﹕ RuntimeException when trying to unbind from service
java.lang.IllegalArgumentException: Service not registered: com.android.emailcommon.service.ServiceProxy$ProxyConnection#1d27587c
at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1029)
at android.app.ContextImpl.unbindService(ContextImpl.java:1808)
at android.content.ContextWrapper.unbindService(ContextWrapper.java:551)
at com.android.emailcommon.service.ServiceProxy$ProxyConnection$1.doInBackground(ServiceProxy.java:124)
at com.android.emailcommon.service.ServiceProxy$ProxyConnection$1.doInBackground(ServiceProxy.java:111)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
If you are building a custom ROM and are modifying the com.android.mms and com.android.email apps, then perhaps these are your issues.
Otherwise, they are issues for the developers of the com.android.mms and com.android.email apps.