could anyone please help me , why I cannot run this simple app , it was on Udemy tutorials , I have checked many times , exactly like it is in the tutorial
package com.example.hp250.actions;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import java.lang.reflect.InvocationTargetException;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void OpenApp(View view) {
Intent intent=new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.soundcloud.android"));
startActivity(intent);
}
}
log cat :
02-29 06:56:17.774 4886-4886/com.example.hp250.actions I/art: Not late-enabling -Xcheck:jni (already on)
02-29 06:56:17.775 4886-4886/com.example.hp250.actions I/art: Late-enabling JIT
02-29 06:56:17.777 4886-4886/com.example.hp250.actions I/art: JIT created with code_cache_capacity=2MB compile_threshold=1000
02-29 06:56:17.843 4886-4886/com.example.hp250.actions W/System: ClassLoader referenced unknown path: /data/app/com.example.hp250.actions-1/lib/x86
02-29 06:56:18.013 4886-4910/com.example.hp250.actions D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
02-29 06:56:18.056 4886-4910/com.example.hp250.actions I/OpenGLRenderer: Initialized EGL, version 1.4
02-29 06:56:18.190 4886-4910/com.example.hp250.actions W/EGL_emulation: eglSurfaceAttrib not implemented
02-29 06:56:18.190 4886-4910/com.example.hp250.actions W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xad7607e0, error=EGL_SUCCESS
02-29 06:56:20.394 4886-4886/com.example.hp250.actions D/AndroidRuntime: Shutting down VM
02-29 06:56:20.395 4886-4886/com.example.hp250.actions E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.hp250.actions, PID: 4886
java.lang.IllegalStateException: Could not execute method for android:onClick
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:275)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
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)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:270)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
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)
Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.soundcloud.android }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1798)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1512)
at android.app.Activity.startActivityForResult(Activity.java:3917)
at android.app.Activity.startActivityForResult(Activity.java:3877)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:784)
at android.app.Activity.startActivity(Activity.java:4200)
at android.app.Activity.startActivity(Activity.java:4168)
at com.example.hp250.actions.MainActivity.OpenApp(MainActivity.java:23)
at java.lang.reflect.Method.invoke(Native Method)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:270)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
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)
02-29 06:56:22.922 4886-4886/? I/Process: Sending signal. PID: 4886 SIG: 9
Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.soundcloud.android }
You are running your app on a device or emulator that lacks the Play Store or any other activity that handles market://details Uri values for ACTION_VIEW.
Related
I have got Service in android app2. I want to start Service from app1 and pass Album object in Intent to Service in app2.
In app1
var alb: Album = Album()
alb.name="album name"
alb.numOfSongs=1
alb.thumbnail=2
var serviceIntent: Intent = Intent();
var componentName: ComponentName = ComponentName("com.eusecom.demoad","com.eusecom.demoad.view.EkasaService")
serviceIntent.setComponent(componentName)
serviceIntent.putExtra("albumpar", alb)
context.startService(serviceIntent)
In app2 in Service class
#Override
public int onStartCommand(Intent intent, int flags, int startId) {
Album alb = intent.getParcelableExtra("albumpar");
}
I can to pass String in Intent. If i put to Intent the Parcelable i get error.
02-27 14:12:18.438 22198-22198/com.eusecom.demoad E/Parcel: Class not found when unmarshalling: com.eusecom.samshopersung.models.Album
java.lang.ClassNotFoundException: com.eusecom.samshopersung.models.Album
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:400)
at android.os.Parcel.readParcelableCreator(Parcel.java:2517)
at android.os.Parcel.readParcelable(Parcel.java:2471)
at android.os.Parcel.readValue(Parcel.java:2374)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2727)
at android.os.BaseBundle.unparcel(BaseBundle.java:269)
at android.os.BaseBundle.getString(BaseBundle.java:992)
at android.content.Intent.getStringExtra(Intent.java:6743)
at com.eusecom.demoad.view.EkasaService.onStartCommand(EkasaService.java:29)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3685)
at android.app.ActivityThread.-wrap23(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1740)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6692)
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.ClassNotFoundException: Didn't find class "com.eusecom.samshopersung.models.Album" on path: DexPathList[[zip file "/data/app/com.eusecom.demoad-1/base.apk"],nativeLibraryDirectories=[/data/app/com.eusecom.demoad-1/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:400)
at android.os.Parcel.readParcelableCreator(Parcel.java:2517)
at android.os.Parcel.readParcelable(Parcel.java:2471)
at android.os.Parcel.readValue(Parcel.java:2374)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2727)
at android.os.BaseBundle.unparcel(BaseBundle.java:269)
at android.os.BaseBundle.getString(BaseBundle.java:992)
at android.content.Intent.getStringExtra(Intent.java:6743)
at com.eusecom.demoad.view.EkasaService.onStartCommand(EkasaService.java:29)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3685)
at android.app.ActivityThread.-wrap23(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1740)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6692)
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)
02-27 14:12:18.439 22198-22198/com.eusecom.demoad D/AndroidRuntime: Shutting down VM
02-27 14:12:18.440 22198-22198/com.eusecom.demoad E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.eusecom.demoad, PID: 22198
java.lang.RuntimeException: Unable to start service com.eusecom.demoad.view.EkasaService#fe9af21 with Intent { cmp=com.eusecom.demoad/.view.EkasaService launchParam=MultiScreenLaunchParams { mDisplayId=0 mFlags=0 } (has extras) }: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.eusecom.samshopersung.models.Album
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3702)
at android.app.ActivityThread.-wrap23(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1740)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6692)
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: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.eusecom.samshopersung.models.Album
at android.os.Parcel.readParcelableCreator(Parcel.java:2545)
at android.os.Parcel.readParcelable(Parcel.java:2471)
at android.os.Parcel.readValue(Parcel.java:2374)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2727)
at android.os.BaseBundle.unparcel(BaseBundle.java:269)
at android.os.BaseBundle.getString(BaseBundle.java:992)
at android.content.Intent.getStringExtra(Intent.java:6743)
at com.eusecom.demoad.view.EkasaService.onStartCommand(EkasaService.java:29)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3685)
at android.app.ActivityThread.-wrap23(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1740)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6692)
at java.lang.reflect.Method.invoke(Native Method)
You are better off serializing the object to a String, passing the String in the Intent and then deserialize the String to an object in the target application.
first time getting below exception on activity startup & could not find out what is the cause.any help will be appreciated.
08-24 11:05:01.218 16287-16287/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.myproject, PID: 16287
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myproject/com.myproject.common.calendar.CalendarMainActivity}: kotlin.a
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2659)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2720)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1466)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6111)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: kotlin.a
at com.myproject.common.calendar.CalendarMainActivity.R(SourceFile:79)
at com.myproject.common.calendar.CalendarMainActivity.m(SourceFile:73)
at com.myproject.common.activity.a.setContentView(SourceFile:90)
at com.myproject.common.calendar.CalendarMainActivity.onCreate(SourceFile:47)
at android.app.Activity.performCreate(Activity.java:6734)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2612)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2720)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1466)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6111)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
I have tried everything from tutorials, answers all around, even with examples from https://github.com/facebook/facebook-android-sdk/tree/master/samples. I have tried with test app and normal app in developers.facebook.com/apps
But i always get this error
A valid Facebook app id must be set in the AndroidManifest.xml or set by calling FacebookSdk.setApplicationId before initializing the sdk.
Full error:
05-31 22:19:09.798 2895-2895/jonjon.fb1 I/art: Not late-enabling -Xcheck:jni (already on)
05-31 22:19:09.868 2895-2895/jonjon.fb1 W/System: ClassLoader referenced unknown path: /data/app/jonjon.fb1-1/lib/x86_64
05-31 22:19:09.888 2895-2895/jonjon.fb1 I/FacebookInitProvider: Failed to auto initialize the Facebook SDK
A valid Facebook app id must be set in the AndroidManifest.xml or set by calling FacebookSdk.setApplicationId before initializing the sdk.
at com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:275)
at com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:231)
at com.facebook.internal.FacebookInitProvider.onCreate(FacebookInitProvider.java:20)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
at android.app.ActivityThread.installProvider(ActivityThread.java:5153)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
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)
05-31 22:19:09.892 2895-2895/jonjon.fb1 D/AndroidRuntime: Shutting down VM
--------- beginning of crash
05-31 22:19:09.892 2895-2895/jonjon.fb1 E/AndroidRuntime: FATAL EXCEPTION: main
Process: jonjon.fb1, PID: 2895
java.lang.RuntimeException: Unable to get provider com.facebook.accountkit.internal.AccountKitInitProvider: 500: Initialization error: 502: The App Id must be specified in the string resource file as com.facebook.sdk.ApplicationId
at android.app.ActivityThread.installProvider(ActivityThread.java:5156)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
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: 500: Initialization error: 502: The App Id must be specified in the string resource file as com.facebook.sdk.ApplicationId
at com.facebook.accountkit.internal.Initializer.getRequiredString(Initializer.java:228)
at com.facebook.accountkit.internal.Initializer.initialize(Initializer.java:113)
at com.facebook.accountkit.internal.AccountKitController.initialize(AccountKitController.java:592)
at com.facebook.accountkit.internal.AccountKitInitProvider.onCreate(AccountKitInitProvider.java:31)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
at android.app.ActivityThread.installProvider(ActivityThread.java:5153)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
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)
05-31 22:41:18.585 3969-3969/jonjon.fb1 D/AndroidRuntime: Shutting down VM
05-31 22:41:18.585 3969-3969/jonjon.fb1 E/AndroidRuntime: FATAL EXCEPTION: main
Process: jonjon.fb1, PID: 3969
java.lang.RuntimeException: Unable to get provider com.facebook.accountkit.internal.AccountKitInitProvider: 500: Initialization error: 503: The Client Token must be specified in the string resource file as com.facebook.accountkit.ClientToken
at android.app.ActivityThread.installProvider(ActivityThread.java:5156)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
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: 500: Initialization error: 503: The Client Token must be specified in the string resource file as com.facebook.accountkit.ClientToken
at com.facebook.accountkit.internal.Initializer.getRequiredString(Initializer.java:228)
at com.facebook.accountkit.internal.Initializer.initialize(Initializer.java:118)
at com.facebook.accountkit.internal.AccountKitController.initialize(AccountKitController.java:592)
at com.facebook.accountkit.internal.AccountKitInitProvider.onCreate(AccountKitInitProvider.java:31)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
at android.app.ActivityThread.installProvider(ActivityThread.java:5153)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
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)
Add
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//initialize Facebook SDK
FacebookSdk.setClientToken("XXXXXXXXXXXXX");
FacebookSdk.sdkInitialize(getApplicationContext());
if (BuildConfig.DEBUG) {
FacebookSdk.setIsDebugEnabled(true);
FacebookSdk.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS);
} }
Add
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//initialize Facebook SDK
FacebookSdk.sdkInitialize(getApplicationContext());
if (BuildConfig.DEBUG) {
FacebookSdk.setIsDebugEnabled(true);
FacebookSdk.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS);
}
setContentView(R.layout.activity_main); }
It fails to initialize the library.
I think the solution as said in the logcat is to add a string in strings.xml with the name
com.facebook.sdk.ApplicationId
As value you must put the token
Then you can call
FacebookSdk.sdkInitialize(this);
In onCreate
Since FacebookSdk.sdkInitialize(getApplicationContext()); is deprecated. You can use these methods to initialize facebookSDK
FacebookSdk.fullyInitialize();
AppEventsLogger.activateApp(application);
It works fine
I have Firebase fully installed into Android Studio, and I've tested it with a couple 1 activity applications, but on the only application with more than one activity, it's not working.
When I try to do the following in my 'Sign up' code:
private void makeStudent(String email, String password) {
Student s = new Student(email, password);
Firebase ref = new Firebase("MYAPP.firebaseio.com/");
//took out my app name
Firebase studentlocation = ref.child("Student");
studentlocation.setValue(s); //this is the line on which I get the error
//also, when I go on my firebase site, it hasn't created the Student
//directory
}
The Firebase page said:
If your Android app has multiple activities, add this code to your Application Class. Otherwise add it in your main activity.
So, I looked around, and this is what I created:
I made a MyApplication.java file, which contained:
import com.firebase.client.Firebase;
public class MyApplication extends android.app.Application {
#Override
public void onCreate() {
super.onCreate();
Firebase.setAndroidContext(this);
}
}
Then I placed the following into AndroidManifest.xml:
android:name=".MyApplication"
Yet, I still receive an error on the exact same line.
How do I fix this Firebase issue? I appreciate any help I can get, please!
ERROR RECEIVED (scroll to the right in the code box):
FATAL EXCEPTION: main
Process: professionalgrader.professionalgrader, PID: 3827
com.firebase.client.FirebaseException: Failed to parse to snapshot
at com.firebase.client.Firebase.setValueInternal(Firebase.java:347)
at com.firebase.client.Firebase.setValue(Firebase.java:238)
at professionalgrader.professionalgrader.SignUp.makeStudent(SignUp.java:94)
at professionalgrader.professionalgrader.SignUp.access$500(SignUp.java:16)
at professionalgrader.professionalgrader.SignUp$1.onClick(SignUp.java:45)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
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)
Caused by: java.lang.IllegalArgumentException: length=0; index=0 (through reference chain: professionalgrader.professionalgrader.Student["listofTermClasses"])
at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:2615)
at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:2542)
at com.firebase.client.Firebase.setValueInternal(Firebase.java:336)
at com.firebase.client.Firebase.setValue(Firebase.java:238)
at professionalgrader.professionalgrader.SignUp.makeStudent(SignUp.java:94)
at professionalgrader.professionalgrader.SignUp.access$500(SignUp.java:16)
at professionalgrader.professionalgrader.SignUp$1.onClick(SignUp.java:45)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
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)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: length=0; index=0 (through reference chain: professionalgrader.professionalgrader.Student["listofTermClasses"])
at com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:184)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:605)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:142)
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:118)
at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:2593)
at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:2542)
at com.firebase.client.Firebase.setValueInternal(Firebase.java:336)
at com.firebase.client.Firebase.setValue(Firebase.java:238)
at professionalgrader.professionalgrader.SignUp.makeStudent(SignUp.java:94)
at professionalgrader.professionalgrader.SignUp.access$500(SignUp.java:16)
at professionalgrader.professionalgrader.SignUp$1.onClick(SignUp.java:45)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
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)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
at professionalgrader.professionalgrader.Student.getListofTermClasses(Student.java:252)
at java.lang.reflect.Method.invoke(Native Method)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.get(BeanPropertyWriter.java:679)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:534)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:597)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:142)
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:118)
at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:2593)
at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:2542)
at com.firebase.client.Firebase.setValueInternal(Firebase.java:336)
at com.firebase.client.Firebase.setValue(Firebase.java:238)
at professionalgrader.professionalgrader.SignUp.makeStudent(SignUp.java:94)
at professionalgrader.professionalgrader.SignUp.access$500(SignUp.java:16)
at professionalgrader.professionalgrader.SignUp$1.onClick(SignUp.java:45)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
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)
THE SECOND ERROR:
06-15 04:13:34.902 3089-3089/professionalgrader.professionalgrader E/AndroidRuntime: FATAL EXCEPTION: main
Process: professionalgrader.professionalgrader, PID: 3089
com.firebase.client.FirebaseException: Failed to parse to snapshot
at com.firebase.client.Firebase.setValueInternal(Firebase.java:347)
at com.firebase.client.Firebase.setValue(Firebase.java:238)
at professionalgrader.professionalgrader.SignUp.makeStudent(SignUp.java:94)
at professionalgrader.professionalgrader.SignUp.access$500(SignUp.java:16)
at professionalgrader.professionalgrader.SignUp$1.onClick(SignUp.java:45)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
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)
Caused by: java.lang.IllegalArgumentException: Attempt to invoke virtual method 'double professionalgrader.professionalgrader.Class.getGPA()' on a null object reference (through reference chain: professionalgrader.professionalgrader.Student["totalGPA"])
at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:2615)
at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:2542)
at com.firebase.client.Firebase.setValueInternal(Firebase.java:336)
at com.firebase.client.Firebase.setValue(Firebase.java:238)
at professionalgrader.professionalgrader.SignUp.makeStudent(SignUp.java:94)
at professionalgrader.professionalgrader.SignUp.access$500(SignUp.java:16)
at professionalgrader.professionalgrader.SignUp$1.onClick(SignUp.java:45)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
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)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Attempt to invoke virtual method 'double professionalgrader.professionalgrader.Class.getGPA()' on a null object reference (through reference chain: professionalgrader.professionalgrader.Student["totalGPA"])
at com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:184)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:605)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:142)
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:118)
at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:2593)
at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:2542)
at com.firebase.client.Firebase.setValueInternal(Firebase.java:336)
at com.firebase.client.Firebase.setValue(Firebase.java:238)
at professionalgrader.professionalgrader.SignUp.makeStudent(SignUp.java:94)
at professionalgrader.professionalgrader.SignUp.access$500(SignUp.java:16)
at professionalgrader.professionalgrader.SignUp$1.onClick(SignUp.java:45)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
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)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'double professionalgrader.professionalgrader.Class.getGPA()' on a null object reference
at professionalgrader.professionalgrader.Student.getTotalGPA(Student.java:199)
at java.lang.reflect.Method.invoke(Native Method)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.get(BeanPropertyWriter.java:679)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:534)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:597)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:142)
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:118)
at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:2593)
at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:2542)
at com.firebase.client.Firebase.setValueInternal(Firebase.java:336)
at com.firebase.client.Firebase.setValue(Firebase.java:238)
at professionalgrader.professionalgrader.SignUp.makeStudent(SignUp.java:94)
at professionalgrader.professionalgrader.SignUp.access$500(SignUp.java:16)
at professionalgrader.professionalgrader.SignUp$1.onClick(SignUp.java:45)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
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)
Possible source of error because it told me it couldn't obtain the Snapshot at the line in makeStudent(), but makeStudent() doesn't use Snapshot. Only userExists() does. Note: The variable 'exists' is defined as a static boolean in the SignUp class.
private boolean userExists() {
Firebase ref = new Firebase("MYAPPNAME.firebaseio.com");
ref.addValueEventListener(new ValueEventListener() {
#Override
public void onDataChange(DataSnapshot snapshot) {
for (DataSnapshot postSnapShot: snapshot.getChildren()) {
Student s = postSnapShot.getValue(Student.class);
if(s.getEmail().equals(mEmailView.getText().toString())) {
exists = true;
}
}
}
#Override
public void onCancelled(FirebaseError firebaseError) {
exists = true;
}
});
return exists;
}
SOLUTION TO MY ISSUE:
I realized that Snapshot was never used in makeStudent(), and that was where the error started. Thus, I looked in the only place it was used... userExists(), and it turned out that I was correct! The error was produced by trying to identify Student s as a nonexistent student! Thus, I actually needed a try like such:
private boolean userExists() {
Firebase ref = new Firebase("MYAPPNAME.firebaseio.com");
ref.addValueEventListener(new ValueEventListener() {
#Override
public void onDataChange(DataSnapshot snapshot) {
Student s;
for (DataSnapshot postSnapShot: snapshot.getChildren()) {
try {
s = postSnapShot.getValue(Student.class);
if(s.getEmail().equals(mEmailView.getText().toString())) {
System.out.println(snapshot.getValue());
exists = true;
}
} catch(Exception e) {
exists = false;
}
}
}
#Override
public void onCancelled(FirebaseError firebaseError) {
exists = true;
}
});
return exists;
}
This is my code for BlurredGridMenu. But error occurs everytime I try to get the blur menu. I can't find where the error is.
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;
import com.goka.blurredgridmenu.GridMenu;
import com.goka.blurredgridmenu.GridMenuFragment;
import java.util.ArrayList;
import java.util.List;
/**
* Created by duSHAn maduSHAnka on 2016-01-25.
*/
public class Test3 extends AppCompatActivity {
private GridMenuFragment mGridMenuFragment;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.test3);
mGridMenuFragment = GridMenuFragment.newInstance(R.drawable.background);
findViewById(R.id.show_menu_button).setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
FragmentTransaction tx = getSupportFragmentManager().beginTransaction();
tx.replace(R.id.main_frame, mGridMenuFragment);
tx.addToBackStack(null);
tx.commit();
}
});
setupGridMenu();
mGridMenuFragment.setOnClickMenuListener(new GridMenuFragment.OnClickMenuListener() {
#Override
public void onClickMenu(GridMenu gridMenu, int position) {
Toast.makeText(Test3.this, "Title:" + gridMenu.getTitle() + ", Position:" + position,
Toast.LENGTH_SHORT).show();
}
});
}
private void setupGridMenu() {
List<GridMenu> menus = new ArrayList<>();
menus.add(new GridMenu("Home", R.drawable.n));
menus.add(new GridMenu("Calendar", R.drawable.nn));
menus.add(new GridMenu("Overview", R.drawable.nnn));
menus.add(new GridMenu("Groups", R.drawable.nnnn));
menus.add(new GridMenu("Lists", R.drawable.nnnnn));
menus.add(new GridMenu("Profile", R.drawable.nnnnnn));
mGridMenuFragment.setupMenu(menus);
}
#Override
public void onBackPressed() {
if (0 == getSupportFragmentManager().getBackStackEntryCount()) {
super.onBackPressed();
} else {
getSupportFragmentManager().popBackStack();
}
}
}
Did I make any error here??
This is my XML file.
<?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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Test3">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/background"
>
<Button
android:id="#+id/show_menu_button"
android:layout_centerInParent="true"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#android:color/white"
android:text="Show Menu"
android:textSize="18sp"
android:gravity="center"
android:layout_margin="16dp"
android:textColor="#android:color/black"
android:alpha="0.8"/>
</RelativeLayout>
<FrameLayout
android:id="#+id/main_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</RelativeLayout>
This is the error. LogCat
03-02 13:02:40.453 17063-17063/? I/art: Late-enabling -Xcheck:jni
03-02 13:02:40.850 17063-17063/com.ceatkelanisrilanka.dushanmadushanka.ceat I/AppCompatViewInflater: app:theme is now deprecated. Please move to using android:theme instead.
03-02 13:02:40.998 17063-17083/com.ceatkelanisrilanka.dushanmadushanka.ceat D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
03-02 13:02:41.009 17063-17063/com.ceatkelanisrilanka.dushanmadushanka.ceat D/Atlas: Validating map...
03-02 13:02:41.190 17063-17083/com.ceatkelanisrilanka.dushanmadushanka.ceat D/libEGL: loaded /system/lib/egl/libEGL_emulation.so
03-02 13:02:41.191 17063-17083/com.ceatkelanisrilanka.dushanmadushanka.ceat D/libEGL: loaded /system/lib/egl/libGLESv1_CM_emulation.so
03-02 13:02:41.207 17063-17083/com.ceatkelanisrilanka.dushanmadushanka.ceat D/libEGL: loaded /system/lib/egl/libGLESv2_emulation.so
03-02 13:02:41.266 17063-17083/com.ceatkelanisrilanka.dushanmadushanka.ceat I/OpenGLRenderer: Initialized EGL, version 1.4
03-02 13:02:41.314 17063-17083/com.ceatkelanisrilanka.dushanmadushanka.ceat D/OpenGLRenderer: Enabling debug mode 0
03-02 13:02:41.334 17063-17083/com.ceatkelanisrilanka.dushanmadushanka.ceat W/EGL_emulation: eglSurfaceAttrib not implemented
03-02 13:02:41.334 17063-17083/com.ceatkelanisrilanka.dushanmadushanka.ceat W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xef0358c0, error=EGL_SUCCESS
03-02 13:02:45.895 17063-17083/com.ceatkelanisrilanka.dushanmadushanka.ceat W/EGL_emulation: eglSurfaceAttrib not implemented
03-02 13:02:45.895 17063-17083/com.ceatkelanisrilanka.dushanmadushanka.ceat W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xf3f73740, error=EGL_SUCCESS
03-02 13:02:47.479 17063-17063/com.ceatkelanisrilanka.dushanmadushanka.ceat D/AndroidRuntime: Shutting down VM
03-02 13:02:47.484 17063-17063/com.ceatkelanisrilanka.dushanmadushanka.ceat E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ceatkelanisrilanka.dushanmadushanka.ceat, PID: 17063
android.view.InflateException: Binary XML file line #13: Error inflating class com.goka.blurredgridmenu.BlurringView
at android.view.LayoutInflater.createView(LayoutInflater.java:633)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.goka.blurredgridmenu.GridMenuFragment.onCreateView(GridMenuFragment.java:39)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.goka.blurredgridmenu.GridMenuFragment.onCreateView(GridMenuFragment.java:39)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v8/renderscript/RenderScript;
at com.goka.blurredgridmenu.BlurringView.initializeRenderScript(BlurringView.java:112)
at com.goka.blurredgridmenu.BlurringView.<init>(BlurringView.java:54)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.goka.blurredgridmenu.GridMenuFragment.onCreateView(GridMenuFragment.java:39)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v8.renderscript.RenderScript" on path: DexPathList[[zip file "/data/app/com.ceatkelanisrilanka.dushanmadushanka.ceat-3/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.goka.blurredgridmenu.BlurringView.initializeRenderScript(BlurringView.java:112)
at com.goka.blurredgridmenu.BlurringView.<init>(BlurringView.java:54)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.goka.blurredgridmenu.GridMenuFragment.onCreateView(GridMenuFragment.java:39)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Suppressed: java.lang.ClassNotFoundException: android.support.v8.renderscript.RenderScript
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 26 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
What did i do wrong?
I know its too late to answer this question, but it may help others who are facing the same issue.
The below issue, comes into the picture if you are not defining the "renderscript" in build.gradle file in the app folder of your application module. As, per the guidelines of Library maker.
android.view.InflateException: Binary XML file line #13: Error inflating class com.goka.blurredgridmenu.BlurringView
So, you need to enable the renderscript, like below
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
minSdkVersion 8
targetSdkVersion 23
renderscriptTargetApi 22
renderscriptSupportModeEnabled true
}
}
Note:
If you are using renderscriptTargetApi as 22, then I am sorry you will going to face one issue saying....
Renderscript support mode is not currently supported with renderscript target 21+
Yep, this is a bug and the bug is related to renderscriptTargetApi
How you can resolve the above issue.
Solution 1:
You can define renderscriptTargetApi below 2, like:
renderscriptTargetApi 20
renderscriptSupportModeEnabled true
Solution 2:
The bug related to renderscriptTargetApi has been fixed in gradle-plugin 2.1.0 and Build-Tools 23.0.3. Hence you can try this too.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
Hope, this may help you and someone else.