Run-time error "inflating class fragment" - android

I have an activity, what I'm trying to do is to start a new activity that holds a Google Maps Fragment API v2 following this example (https://developers.google.com/maps/documentation/android/start). I get an runtime error
"Binary XML file line #4: Error inflating class fragment"
This the XML of activity:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment"/>
</LinearLayout>
and this is the activity's class:
import android.app.Activity;
import android.os.Bundle;
public class MapsActivity extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map_act);
// TODO Auto-generated method stub
}
}
and this is the logcat:
12-18 11:59:37.584: W/dalvikvm(9480): threadid=1: thread exiting with uncaught exception (group=0x2b6a3300)
12-18 11:59:37.594: E/AndroidRuntime(9480): FATAL EXCEPTION: main
12-18 11:59:37.594: E/AndroidRuntime(9480): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dimacroitori.supermarket/com.dimacroitori.supermarket.MapsActivity}: android.view.InflateException: Binary XML file line #4: Error inflating class fragment
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2190)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2215)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.ActivityThread.access$600(ActivityThread.java:144)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.os.Handler.dispatchMessage(Handler.java:99)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.os.Looper.loop(Looper.java:137)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.ActivityThread.main(ActivityThread.java:4939)
12-18 11:59:37.594: E/AndroidRuntime(9480): at java.lang.reflect.Method.invokeNative(Native Method)
12-18 11:59:37.594: E/AndroidRuntime(9480): at java.lang.reflect.Method.invoke(Method.java:511)
12-18 11:59:37.594: E/AndroidRuntime(9480): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
12-18 11:59:37.594: E/AndroidRuntime(9480): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
12-18 11:59:37.594: E/AndroidRuntime(9480): at dalvik.system.NativeStart.main(Native Method)
12-18 11:59:37.594: E/AndroidRuntime(9480): Caused by: android.view.InflateException: Binary XML file line #4: Error inflating class fragment
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
12-18 11:59:37.594: E/AndroidRuntime(9480): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:257)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.Activity.setContentView(Activity.java:1867)
12-18 11:59:37.594: E/AndroidRuntime(9480): at com.exmaple.MapsActivity.onCreate(MapsActivity.java:12)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.Activity.performCreate(Activity.java:5008)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
12-18 11:59:37.594: E/AndroidRuntime(9480): ... 11 more
12-18 11:59:37.594: E/AndroidRuntime(9480): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.MapFragment: make sure class name exists, is public, and has an empty constructor that is public
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.Fragment.instantiate(Fragment.java:584)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.Fragment.instantiate(Fragment.java:552)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.Activity.onCreateView(Activity.java:4656)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
12-18 11:59:37.594: E/AndroidRuntime(9480): ... 20 more
12-18 11:59:37.594: E/AndroidRuntime(9480): Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.MapFragment
12-18 11:59:37.594: E/AndroidRuntime(9480): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
12-18 11:59:37.594: E/AndroidRuntime(9480): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-18 11:59:37.594: E/AndroidRuntime(9480): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.Fragment.instantiate(Fragment.java:574)
12-18 11:59:37.594: E/AndroidRuntime(9480): ... 23 more
Can someone explain me what I'm doing wrong?

Make sure that you have added the Google Play Services Android library project to your application, where that class is defined. Also make sure that you are running your app on an API Level 11 or higher environment, since you are attempting to use native fragments (rather than the Android Support package's backport).

Related

master/detail actionbar fragments

I have found this https://github.com/abidk/android_masterdetail_tab_issue and it is exactly the base for my app, great work from abidk. It executes perfect on tablet and adding more fragments is very easy but on phone it is producing an error: what could be the reason and how to fix it?
D/dalvikvm(3695): Late-enabling CheckJNI
D/AndroidRuntime(3695): Shutting down VM
W/dalvikvm(3695): threadid=1: thread exiting with uncaught exception (group=0x41b192a0)
E/AndroidRuntime(3695): FATAL EXCEPTION: main
E/AndroidRuntime(3695): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.example.masterdetail_tabs/com.example.example.masterdetail_tabs.ItemListActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
E/AndroidRuntime(3695): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2092)
E/AndroidRuntime(3695): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117)
E/AndroidRuntime(3695): at android.app.ActivityThread.access$700(ActivityThread.java:134)
E/AndroidRuntime(3695): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218)
E/AndroidRuntime(3695): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(3695): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(3695): at android.app.ActivityThread.main(ActivityThread.java:4867)
E/AndroidRuntime(3695): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(3695): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(3695): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
E/AndroidRuntime(3695): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
E/AndroidRuntime(3695): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(3695): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
E/AndroidRuntime(3695): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
E/AndroidRuntime(3695): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
E/AndroidRuntime(3695): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
E/AndroidRuntime(3695): at com.example.example.masterdetail_tabs.Tab1Fragment.onCreateView(Tab1Fragment.java:18)
E/AndroidRuntime(3695): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:829)
E/AndroidRuntime(3695): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1035)
E/AndroidRuntime(3695): at android.app.BackStackRecord.run(BackStackRecord.java:635)
E/AndroidRuntime(3695): at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1399)
E/AndroidRuntime(3695): at android.app.Activity.performStart(Activity.java:5056)
E/AndroidRuntime(3695): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2065)
E/AndroidRuntime(3695): ... 11 more
E/AndroidRuntime(3695): Caused by: java.lang.ClassCastException: com.example.example.masterdetail_tabs.ItemListFragment cannot be cast to android.support.v4.app.Fragment
E/AndroidRuntime(3695): at android.support.v4.app.Fragment.instantiate(Fragment.java:394)
E/AndroidRuntime(3695): at android.support.v4.app.Fragment.instantiate(Fragment.java:369)
E/AndroidRuntime(3695): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:272)
E/AndroidRuntime(3695): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
E/AndroidRuntime(3695): ... 20 more
I/Process(3695): Sending signal. PID: 3695 SIG: 9
It's hard to know for sure without seeing your code but it looks like you inherited or imported the wrong Fragment for either your ItemListFragment or the Activity using it.
Your logcat shows the exception as:
Caused by: java.lang.ClassCastException: com.example.example.masterdetail_tabs.ItemListFragment cannot be cast to android.support.v4.app.Fragment
Check your usages and imports etc
import android.support.v4.app.Fragment;
vs
import android.app.Fragment
Also be mindful of which variants of Activity and Fragment can make use of which types and are compatible with which versions of the API. You should read and follow the official Android tutorial on Fragments for further info and proper usages.

Zbar : startPreview failed in galaxy S3

I have used ZBAR library to scan bar code in my Application.
And I got this error log while opening camera on Samsung Galaxy S3 :
java.lang.RuntimeException: startPreview failed
at android.hardware.Camera.startPreview(Native Method)
at com.SGID.MainApp.ScanningFragment.engageCamera(ScanningFragment.java:184)
at com.SGID.MainApp.ScanningFragment.access$10(ScanningFragment.java:154)
at com.SGID.MainApp.ScanningFragment$4.run(ScanningFragment.java:111)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: Unable to start activity ComponentInfo
{com.SGID.MainApp/com.SGID.MainApp.AllTabsActivity}
: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
at android.app.ActivityThread.access$600(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.SGID.MainApp.ParametersFragment.onCreateView(ParametersFragment.java:78)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1478)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1877)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:552)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1167)
at android.app.Activity.performStart(Activity.java:5216)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2073)
... 11 more
EDIT :
Getting error at this line :
CameraPreview mPreview = new CameraPreview(getActivity(), mCamera, previewCb,
autoFocusCB);
Can Anyone help me to resolve this error??
Thanks in advance..

Class cannot be cast to android.app.Fragment on FragmentActivity

I'm getting the following error trying to start an activity with a Fragment
08-09 13:50:57.070: ERROR/AndroidRuntime(1446): FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{br.com.zap.imoveis/br.com.zap.imoveis.ui.ResultadoBusca}: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
at com.actionbarsherlock.internal.ActionBarSherlockNative.setContentView(ActionBarSherlockNative.java:133)
at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:261)
at br.com.zap.imoveis.ui.ResultadoBusca.onCreate(ResultadoBusca.java:54)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
... 11 more
Caused by: java.lang.ClassCastException: br.com.zap.imoveis.ui.ResultadoBuscaMapa cannot be cast to android.app.Fragment
at android.app.Fragment.instantiate(Fragment.java:577)
at android.app.Fragment.instantiate(Fragment.java:552)
at android.app.Activity.onCreateView(Activity.java:4656)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
... 22 more
Despite of what it says here:
Cannot be cast to android.app.Fragment
I have this error even though my Activity extends from android.support.v4.app.FragmentActivity
Unfortunately, error messages some times are very misleading. I've almost rebuilt my application to find out that during a refactor I have accidentally deleted this line o code
super.onCreate(savedInstanceState);
on the onCreate method of my activity.

GoogleMap Support Fragment error

I have a project that uses the GoogleMaps API, and the support library for Fragments. I have a working map in one activity already, so I know that the API and library are all set up right. I am trying to add a map in a fragment as part of a new activity.
The activity extends an android.support.v4.app.FragmentActivity, and the xml file contains:
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="250dp"
android:name="com.google.android.gms.maps.SupportMapFragment" />
But when I run I get the error:
01-20 11:58:31.535: ERROR/AndroidRuntime(5389): FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
at android.app.Activity.setContentView(Activity.java:1835)
at com.yedidyak.gpsalarm.AddAlarm.onCreate(AddAlarm.java:19)
at android.app.Activity.performCreate(Activity.java:4465)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
All the information I can find about this error is about not having the google-play-lib properly installed both as a jar and an imported module, but I have that done - and a working map in another activity.
Any ideas?
You have to reference google play services library instead of adding jar and map_attrs.xml (and other files, like strings.xml) to your project.
If you do, you also might have deleted res/values/map_attrs.xml by accident.

Android app working in debug mode but not when installed

I'm new to Android development and I'm having a weird issue. I am trying to pull and display calendar events from an AsyncTask. This works in debug mode, but if I try to install the application through the apk the application crashes with this error :
12-18 08:57:16.768: E/AndroidRuntime(8642): FATAL EXCEPTION: AsyncTask #2
12-18 08:57:16.768: E/AndroidRuntime(8642): java.lang.RuntimeException: An error occured while executing doInBackground()
12-18 08:57:16.768: E/AndroidRuntime(8642): at android.os.AsyncTask$3.done(AsyncTask.java:299)
12-18 08:57:16.768: E/AndroidRuntime(8642): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
12-18 08:57:16.768: E/AndroidRuntime(8642): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
12-18 08:57:16.768: E/AndroidRuntime(8642): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
12-18 08:57:16.768: E/AndroidRuntime(8642): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
12-18 08:57:16.768: E/AndroidRuntime(8642): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
12-18 08:57:16.768: E/AndroidRuntime(8642): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
12-18 08:57:16.768: E/AndroidRuntime(8642): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
12-18 08:57:16.768: E/AndroidRuntime(8642): at java.lang.Thread.run(Thread.java:856)
12-18 08:57:16.768: E/AndroidRuntime(8642): Caused by: java.lang.IllegalArgumentException: unable to create new instance of class com.a.b.b.a.a.b because it has no accessible default constructor
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.e.aa.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.e.aa.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.e.i.b(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.d.g.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.d.g.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.d.g.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.d.g.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.d.g.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.d.g.a(Unknown Source) 12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.d.g.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.d.g.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.d.f.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.d.f.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.c.t.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.b.d.c.d(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.promevo.bookit.a.f(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.promevo.bookit.a.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.promevo.bookit.f.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.promevo.bookit.f.doInBackground(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at android.os.AsyncTask$2.call(AsyncTask.java:287)
12-18 08:57:16.768: E/AndroidRuntime(8642): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
12-18 08:57:16.768: E/AndroidRuntime(8642): ... 5 more
12-18 08:57:16.768: E/AndroidRuntime(8642): Caused by: java.lang.InstantiationException: can't instantiate class com.a.b.b.a.a.b; no empty constructor
12-18 08:57:16.768: E/AndroidRuntime(8642): at java.lang.Class.newInstanceImpl(Native Method)
12-18 08:57:16.768: E/AndroidRuntime(8642): at java.lang.Class.newInstance(Class.java:1319)
The call that I am making :
Events feed = client.events().list(CalendarSampleActivity.getCalId()).setTimeMin(startPass)
.setTimeMax(endPass).setSingleEvents(true).execute();
Anyone have any ideas? Thanks in advance.
Ok so after some troubleshooting it seems that something is going wrong when using Proguard. If I remove this line from my project.properties file, my application now works:
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt:proguard-google-api-client.txt
Anyone know exactly why this would make a difference?
Read about Proguard and Android here: http://developer.android.com/tools/help/proguard.html
Since you are getting a "No accessible default constructor" exception it is most likely that Proguard has removed this constructor from the package because it couldn't find users of this constructor (Proguard removes inaccessible or unused code from the package to make it smaller). You will have to tell Proguard to keep certain code in the package even though it isn't obviously used.
The other alternative is to disable Proguard for release builds.

Categories

Resources