0

In Api level above 24 exception is

W/System: ClassLoader referenced unknown path: /data/app/com.example.admin.emoji_test-2/lib/x86    

In Aapi level below 24 exception is

08-20 11:45:32.481 1951-1951/com.android.systemui E/StatusBar: couldn't inflate view for notification com.mechmocha.unityproject/0xf
android.view.InflateException: Binary XML file line #24: Error inflating class io.github.rockerhieu.emojicon.EmojiconTextView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:707)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.widget.RemoteViews.apply(RemoteViews.java:2462)
at com.android.systemui.statusbar.BaseStatusBar.inflateViews(BaseStatusBar.java:662)
at com.android.systemui.statusbar.BaseStatusBar.createNotificationViews(BaseStatusBar.java:835)
at com.android.systemui.statusbar.phone.PhoneStatusBar.addNotification(PhoneStatusBar.java:1084)
at com.android.systemui.statusbar.CommandQueue$H.handleMessage(CommandQueue.java:267)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5021)
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:827)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "io.github.rockerhieu.emojicon.EmojiconTextView" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/system/lib, /system/lib/arm, /data/downloads]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.view.LayoutInflater.createView(LayoutInflater.java:559)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
at android.widget.RemoteViews.apply(RemoteViews.java:2462) 
at com.android.systemui.statusbar.BaseStatusBar.inflateViews(BaseStatusBar.java:662) 
at com.android.systemui.statusbar.BaseStatusBar.createNotificationViews(BaseStatusBar.java:835) 
at com.android.systemui.statusbar.phone.PhoneStatusBar.addNotification(PhoneStatusBar.java:1084) 
at com.android.systemui.statusbar.CommandQueue$H.handleMessage(CommandQueue.java:267) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.app.ActivityThread.main(ActivityThread.java:5021) 
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:827) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643) 
at dalvik.system.NativeStart.main(Native Method) 
08-20 11:45:32.481 1951-1951/com.android.systemui W/StatusBar: removeNotification for unknown key: android.os.BinderProxy@4f384f64

this is the custom R.layout.custom_notification xml using io.github.rockerhieu.emojicon.EmojiconTextView

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <io.github.rockerhieu.emojicon.EmojiconTextView
        android:id="@+id/notification_text_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="I \u263A emojicon"
        />
</LinearLayout>

the notification builder java code i have used remoteview to pass it to Notification using .setCustomContentView(remoteCollapsedView)

RemoteViews remoteCollapsedView = new RemoteViews(this.getPackageName(), R.layout.custom_notification); remoteCollapsedView.setTextViewText(R.id.notification_text_view,"hi "+"\u263A "); 
Bundle bundle = new Bundle(); 
bundle.putString("jay","jay");
if(Build.VERSION.SDK_INT >= 24) { 
Notification n = new Notification.Builder(this)
.setContentTitle("New mail from " + "test@gmail.com") 
.setContentText("Subject") 
.setSmallIcon(R.drawable.thumb) 
.setExtras(bundle)
.setCategory("true") 
.setAutoCancel(true) 
.setGroup("hey")
.setCustomContentView(remoteCollapsedView)
.build();
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(0, n);
}

i have library added to gradle

compile 'io.github.rockerhieu:emojicon:+'

when notification comes the app crashes with the above exception , i m confused if it is not possible or i am missing something

jayant singh
  • 929
  • 12
  • 17
  • Is the library included in your project? Are you compiling it in your gradle file? – Gabe Sechan Aug 20 '17 at 07:16
  • yes ofcourse and this class is in dex also – jayant singh Aug 20 '17 at 07:17
  • @GabeSechan is it even possible in notification xml layout ? And just to add in main_activity xml this works but not in notifications – jayant singh Aug 20 '17 at 07:24
  • Have you double checked, that your app is not multidex and if it is follow guidelines on Android Developer website to make your app as multidex? – R. Zagórski Aug 20 '17 at 10:56
  • @R.Zagórski in the apk there is only one dex file , and i have tried it with multiDexEnabled true but still the crash appears . And in activity_main it works but in notification layout it crashes – jayant singh Aug 20 '17 at 19:36
  • In Api level above 24 exception is W/System: ClassLoader referenced unknown path: /data/app/com.example.admin.emoji_test-2/lib/x86 – jayant singh Aug 20 '17 at 19:41
  • give it a version name,, i checked on their github page and its 1.4.2 as of 2016.. try giving this version name and see if error still occurs.. – Aalap Patel Aug 21 '17 at 01:25
  • @AalapPatel nothing changes i have tried 1.4.1 too – jayant singh Aug 21 '17 at 04:00

1 Answers1

-1

I used this library and You need to initialize it first into your usage activity. Take reference of code below.

import io.github.rockerhieu.emojiconize.Emojiconize;

public class MyActivity extends AppCompatActivity {

   @Override
   protected void onCreate(Bundle savedInstanceState) {
        //call it before super method call.. 
        Emojiconize.activity(this).go();
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

Hope this helps.. take a look here for more info..

Aalap Patel
  • 2,058
  • 2
  • 17
  • 31
  • there are two different libraries emojicon and emojiconize , we do not need this while using emojicon , using emojicon xml has to be changed and using emojiconize only adding Emojiconize.activity(this).go(); works refer https://github.com/rockerhieu/emojicon ....................but in my case i dont have activity instead i have a context from broadcast reciever which can not be parsed in to an Activity – jayant singh Aug 21 '17 at 15:06
  • did u try looking at the similar issues in their github page ? – Aalap Patel Aug 21 '17 at 15:29