android: ads cannot be incorporated to the program - android

i have just finished my first app and would like to incorporate ad to the bottom of the app. the coding for the ad banner is solely obtained from the Google website at https://developers.google.com/mobile-ads-sdk/docs/admob/fundamentals, and added to the mainactivity jar. Everything seems fine but then when i run the program, it crashes, logcat and jar coded as follows:
1) How can these be solved? (The program without ads can be run without any error)
2) How to set for ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID" ???
3) My xml is a TableLayout, does it matters? (from the logcat it seems cannot properly inflate the ad?)
Many thanks in advance!!
Jar part:
import com.google.ads.*;
import com.google.ads.AdRequest;
import com.google.ads.AdSize;
import com.google.ads.AdView;
public class MainActivity extends Activity {
AdView adView;
public static final String MY_PUBLISHER_ID = "a123123123123123c"; //this one is correct
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//request TEST ads to avoid being disabled for clicking your own ads
AdRequest adRequest = new AdRequest();
//test mode on EMULATOR
adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
//test mode on DEVICE (this example code must be replaced with your device unique ID)
adRequest.addTestDevice("4G74FC73D62D42B62A7F7DA61EF5F776"); //how to set this? this one is copied from the tutorial only
//create a Banner Ad
adView = new AdView(this, AdSize.BANNER, MY_PUBLISHER_ID);
//call the main layout from xml
TableLayout mainLayout = (TableLayout)findViewById(R.id.tableLayout);
//add the Banner Ad to our main layout
mainLayout.addView(adView);
// Initiate a request to load an ad in TEST mode.
// The test mode will work only on emulators and your specific test device,
// the users will get real ads.
adView.loadAd(adRequest);
}
// ad
#Override
public void onDestroy()
{
if (adView != null) { adView.destroy(); }
super.onDestroy();
}
// ad
Logcat as follows:
10-10 01:17:34.230: D/dalvikvm(13612): Late-enabling CheckJNI
10-10 01:17:34.650: E/dalvikvm(13612): Could not find class 'com.google.ads.AdRequest', referenced from method com.pearappx.acctcalc.MainActivity.onCreate
10-10 01:17:34.650: W/dalvikvm(13612): VFY: unable to resolve new-instance 425 (Lcom/google/ads/AdRequest;) in Lcom/pearappx/acctcalc/MainActivity;
10-10 01:17:34.650: D/dalvikvm(13612): VFY: replacing opcode 0x22 at 0x0009
10-10 01:17:34.650: I/dalvikvm(13612): Could not find method com.google.ads.AdView.destroy, referenced from method com.pearappx.acctcalc.MainActivity.onDestroy
10-10 01:17:34.650: W/dalvikvm(13612): VFY: unable to resolve virtual method 3042: Lcom/google/ads/AdView;.destroy ()V
10-10 01:17:34.650: D/dalvikvm(13612): VFY: replacing opcode 0x6e at 0x0006
10-10 01:17:34.650: D/dalvikvm(13612): DexOpt: unable to opt direct call 0x0bdf at 0x0b in Lcom/pearappx/acctcalc/MainActivity;.onCreate
10-10 01:17:34.650: I/dalvikvm(13612): DexOpt: unable to optimize static field ref 0x02e7 at 0x0e in Lcom/pearappx/acctcalc/MainActivity;.onCreate
10-10 01:17:34.700: I/dalvikvm(13612): DexOpt: unable to optimize static field ref 0x02e8 at 0x1a in Lcom/pearappx/acctcalc/MainActivity;.onCreate
10-10 01:17:34.700: D/dalvikvm(13612): DexOpt: unable to opt direct call 0x0be1 at 0x1e in Lcom/pearappx/acctcalc/MainActivity;.onCreate
10-10 01:17:35.085: D/AndroidRuntime(13612): Shutting down VM
10-10 01:17:35.085: W/dalvikvm(13612): threadid=1: thread exiting with uncaught exception (group=0x40c781f8)
10-10 01:17:35.105: E/AndroidRuntime(13612): FATAL EXCEPTION: main
10-10 01:17:35.105: E/AndroidRuntime(13612): java.lang.NoClassDefFoundError: com.google.ads.AdRequest
10-10 01:17:35.105: E/AndroidRuntime(13612): at com.pearappx.acctcalc.MainActivity.onCreate(MainActivity.java:94)
10-10 01:17:35.105: E/AndroidRuntime(13612): at android.app.Activity.performCreate(Activity.java:4470)
10-10 01:17:35.105: E/AndroidRuntime(13612): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
10-10 01:17:35.105: E/AndroidRuntime(13612): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
10-10 01:17:35.105: E/AndroidRuntime(13612): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
10-10 01:17:35.105: E/AndroidRuntime(13612): at android.app.ActivityThread.access$600(ActivityThread.java:127)
10-10 01:17:35.105: E/AndroidRuntime(13612): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
10-10 01:17:35.105: E/AndroidRuntime(13612): at android.os.Handler.dispatchMessage(Handler.java:99)
10-10 01:17:35.105: E/AndroidRuntime(13612): at android.os.Looper.loop(Looper.java:137)
10-10 01:17:35.105: E/AndroidRuntime(13612): at android.app.ActivityThread.main(ActivityThread.java:4511)
10-10 01:17:35.105: E/AndroidRuntime(13612): at java.lang.reflect.Method.invokeNative(Native Method)
10-10 01:17:35.105: E/AndroidRuntime(13612): at java.lang.reflect.Method.invoke(Method.java:511)
10-10 01:17:35.105: E/AndroidRuntime(13612): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
10-10 01:17:35.105: E/AndroidRuntime(13612): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
10-10 01:17:35.105: E/AndroidRuntime(13612): at dalvik.system.NativeStart.main(Native Method)

I think you forgot to add admob jar to classpath

Hey follow this tutorial
you have missed to add jar into your libs folder

Related

Android GoogleCast Error - java.lang.NoClassDefFoundError: android.support.v7.media.MediaRouterGlobalMediaRouter

Im compiling ChromeCast this Github Project CastVideos-android.in Eclipse environment.I have latest dependencies installed on the project.
When i running the project,its throws this run time error.
05-05 11:25:08.353: E/AndroidRuntime(17660): FATAL EXCEPTION: main
05-05 11:25:08.353: E/AndroidRuntime(17660): java.lang.NoClassDefFoundError: android.support.v7.media.MediaRouter$GlobalMediaRouter$1
05-05 11:25:08.353: E/AndroidRuntime(17660): at android.support.v7.media.MediaRouter$GlobalMediaRouter.<init>(MediaRouter.java:1628)
05-05 11:25:08.353: E/AndroidRuntime(17660): at android.support.v7.media.MediaRouter.getInstance(MediaRouter.java:246)
05-05 11:25:08.353: E/AndroidRuntime(17660): at com.google.android.libraries.cast.companionlibrary.cast.BaseCastManager.<init>(BaseCastManager.java:189)
05-05 11:25:08.353: E/AndroidRuntime(17660): at com.google.android.libraries.cast.companionlibrary.cast.VideoCastManager.<init>(VideoCastManager.java:196)
05-05 11:25:08.353: E/AndroidRuntime(17660): at com.google.android.libraries.cast.companionlibrary.cast.VideoCastManager.initialize(VideoCastManager.java:223)
05-05 11:25:08.353: E/AndroidRuntime(17660): at com.google.sample.cast.refplayer.CastApplication.onCreate(CastApplication.java:43)
05-05 11:25:08.353: E/AndroidRuntime(17660): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1014)
05-05 11:25:08.353: E/AndroidRuntime(17660): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4280)
05-05 11:25:08.353: E/AndroidRuntime(17660): at android.app.ActivityThread.access$1400(ActivityThread.java:143)
05-05 11:25:08.353: E/AndroidRuntime(17660): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1301)
05-05 11:25:08.353: E/AndroidRuntime(17660): at android.os.Handler.dispatchMessage(Handler.java:99)
05-05 11:25:08.353: E/AndroidRuntime(17660): at android.os.Looper.loop(Looper.java:137)
05-05 11:25:08.353: E/AndroidRuntime(17660): at android.app.ActivityThread.main(ActivityThread.java:4950)
05-05 11:25:08.353: E/AndroidRuntime(17660): at java.lang.reflect.Method.invokeNative(Native Method)
05-05 11:25:08.353: E/AndroidRuntime(17660): at java.lang.reflect.Method.invoke(Method.java:511)
05-05 11:25:08.353: E/AndroidRuntime(17660): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:997)
05-05 11:25:08.303: E/dalvikvm(17660): Could not find class 'android.support.v7.media.MediaRouter$GlobalMediaRouter$1', referenced from method android.support.v7.media.MediaRouter$GlobalMediaRouter.<init>
05-05 11:25:08.303: W/dalvikvm(17660): VFY: unable to resolve new-instance 1180 (Landroid/support/v7/media/MediaRouter$GlobalMediaRouter$1;) in Landroid/support/v7/media/MediaRouter$GlobalMediaRouter;
05-05 11:25:08.303: D/dalvikvm(17660): VFY: replacing opcode 0x22 at 0x0035
05-05 11:25:08.303: W/dalvikvm(17660): VFY: unable to find class referenced in signature (Landroid/support/v4/media/session/MediaSessionCompat;)
05-05 11:25:08.313: I/dalvikvm(17660): Could not find method android.support.v4.media.session.MediaSessionCompat.getSessionToken, referenced from method android.support.v7.media.MediaRouter$GlobalMediaRouter.getMediaSessionToken
05-05 11:25:08.313: W/dalvikvm(17660): VFY: unable to resolve virtual method 2967: Landroid/support/v4/media/session/MediaSessionCompat;.getSessionToken ()Landroid/support/v4/media/session/MediaSessionCompat$Token;
05-05 11:25:08.313: D/dalvikvm(17660): VFY: replacing opcode 0x6e at 0x0011
05-05 11:25:08.323: W/dalvikvm(17660): VFY: unable to find class referenced in signature (Landroid/support/v4/media/session/MediaSessionCompat;)
05-05 11:25:08.323: I/dalvikvm(17660): Could not find method android.support.v4.media.session.MediaSessionCompat.getRemoteControlClient, referenced from method android.support.v7.media.MediaRouter$GlobalMediaRouter.setMediaSessionCompat
05-05 11:25:08.323: W/dalvikvm(17660): VFY: unable to resolve virtual method 2966: Landroid/support/v4/media/session/MediaSessionCompat;.getRemoteControlClient ()Ljava/lang/Object;
05-05 11:25:08.323: D/dalvikvm(17660): VFY: replacing opcode 0x6e at 0x000a
05-05 11:25:08.323: I/dalvikvm(17660): Could not find method android.support.v4.media.session.MediaSessionCompat.getMediaSession, referenced from method android.support.v7.media.MediaRouter$GlobalMediaRouter.setMediaSessionCompat
05-05 11:25:08.323: W/dalvikvm(17660): VFY: unable to resolve virtual method 2965: Landroid/support/v4/media/session/MediaSessionCompat;.getMediaSession ()Ljava/lang/Object;
05-05 11:25:08.323: D/dalvikvm(17660): VFY: replacing opcode 0x6e at 0x001e
05-05 11:25:08.333: I/dalvikvm(17660): Could not find method android.support.v4.media.session.MediaSessionCompat.getRemoteControlClient, referenced from method android.support.v7.media.MediaRouter$GlobalMediaRouter.setMediaSessionCompat
05-05 11:25:08.333: W/dalvikvm(17660): VFY: unable to resolve virtual method 2966: Landroid/support/v4/media/session/MediaSessionCompat;.getRemoteControlClient ()Ljava/lang/Object;
05-05 11:25:08.333: D/dalvikvm(17660): VFY: replacing opcode 0x6e at 0x0032
05-05 11:25:08.333: I/dalvikvm(17660): Could not find method android.support.v4.media.session.MediaSessionCompat.addOnActiveChangeListener, referenced from method android.support.v7.media.MediaRouter$GlobalMediaRouter.setMediaSessionCompat
05-05 11:25:08.333: W/dalvikvm(17660): VFY: unable to resolve virtual method 2964: Landroid/support/v4/media/session/MediaSessionCompat;.addOnActiveChangeListener (Landroid/support/v4/media/session/MediaSessionCompat$OnActiveChangeListener;)V
05-05 11:25:08.333: D/dalvikvm(17660): VFY: replacing opcode 0x6e at 0x0044
05-05 11:25:08.333: I/dalvikvm(17660): Failed resolving Landroid/support/v7/media/MediaRouter$GlobalMediaRouter$1; interface 510 'Landroid/support/v4/media/session/MediaSessionCompat$OnActiveChangeListener;'
05-05 11:25:08.333: W/dalvikvm(17660): Link of class 'Landroid/support/v7/media/MediaRouter$GlobalMediaRouter$1;' failed
Go to your projects and check for v7-appcompat jar file. Right click on it and Build Path-> Add to Buildpath
Check buildpath. Specifically Order and Export section if your
v7-appcompat library is checked
Check if your project contains multiple support-v7 library. One is
in your project and another is in the library which you have added
in your project. Just remove the one library which you have added in
your project. And then clean and run your application.

Can't install apps with Eclipse ADT on my phone

I would like to install and debug projects using Eclipse ADT. It finds the device and trys to install but then I get the errors below.
The phone is a "HTC One S" and it is the Custom ROM "Codename Lungo One S" (4.3). The applications are the Kontalk project and the ApiDemos from the 17 (4.2.2) samples both build for 4.2.2.
Installing in the emulator works.
10-10 00:36:30.783: E/AndroidRuntime(2943): *** FATAL EXCEPTION IN SYSTEM PROCESS: main
10-10 00:36:30.783: E/AndroidRuntime(2943): java.lang.SecurityException: Neither user 2000 nor current process has android.permission.INSTALL_PACKAGES.
10-10 00:36:30.783: E/AndroidRuntime(2943): at android.os.Parcel.readException(Parcel.java:1431)
10-10 00:36:30.783: E/AndroidRuntime(2943): at android.os.Parcel.readException(Parcel.java:1385)
10-10 00:36:30.783: E/AndroidRuntime(2943): at android.content.pm.IPackageManager$Stub$Proxy.installPackageWithVerificationAndEncryption(IPackageManager.java:3314)
10-10 00:36:30.783: E/AndroidRuntime(2943): at com.android.commands.pm.Pm.runInstall(Pm.java:931)
10-10 00:36:30.783: E/AndroidRuntime(2943): at com.android.commands.pm.Pm.run(Pm.java:109)
10-10 00:36:30.783: E/AndroidRuntime(2943): at com.android.commands.pm.Pm.main(Pm.java:77)
10-10 00:36:30.783: E/AndroidRuntime(2943): at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
10-10 00:36:30.783: E/AndroidRuntime(2943): at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:235)
10-10 00:36:30.783: E/AndroidRuntime(2943): at dalvik.system.NativeStart.main(Native Method)
10-10 00:36:30.793: E/JavaBinder(2943): Unknown binder error code. 0xfffffff7
10-10 00:36:30.793: E/ServiceManager(2943): error in getService
10-10 00:36:30.793: E/ServiceManager(2943): android.os.RemoteException: Unknown binder error code. 0xfffffff7
10-10 00:36:30.793: E/ServiceManager(2943): at android.os.BinderProxy.transact(Native Method)
10-10 00:36:30.793: E/ServiceManager(2943): at android.os.ServiceManagerProxy.getService(ServiceManagerNative.java:123)
10-10 00:36:30.793: E/ServiceManager(2943): at android.os.ServiceManager.getService(ServiceManager.java:55)
10-10 00:36:30.793: E/ServiceManager(2943): at android.app.ActivityManagerNative$1.create(ActivityManagerNative.java:1911)
10-10 00:36:30.793: E/ServiceManager(2943): at android.app.ActivityManagerNative$1.create(ActivityManagerNative.java:1909)
10-10 00:36:30.793: E/ServiceManager(2943): at android.util.Singleton.get(Singleton.java:34)
10-10 00:36:30.793: E/ServiceManager(2943): at android.app.ActivityManagerNative.getDefault(ActivityManagerNative.java:73)
10-10 00:36:30.793: E/ServiceManager(2943): at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:76)
10-10 00:36:30.793: E/ServiceManager(2943): at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
10-10 00:36:30.793: E/ServiceManager(2943): at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
10-10 00:36:30.793: E/ServiceManager(2943): at dalvik.system.NativeStart.main(Native Method)
10-10 00:36:30.793: E/AndroidRuntime(2943): Error reporting crash
10-10 00:36:30.793: E/AndroidRuntime(2943): java.lang.NullPointerException
10-10 00:36:30.793: E/AndroidRuntime(2943): at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:76)
10-10 00:36:30.793: E/AndroidRuntime(2943): at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
10-10 00:36:30.793: E/AndroidRuntime(2943): at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
10-10 00:36:30.793: E/AndroidRuntime(2943): at dalvik.system.NativeStart.main(Native Method)
Any ideas? Can't find anything on this on the internet?
You can try the
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
before the application tag is start in the AndroidManifest.xml.
I think you are looking for this but you can try clean and build your project first.
The problem is Codename Lungo with CM10.1 and CM10.2. This is a bug or at least you can't debug Apps with the standard procedure. It works on my phone with CL CM10 and CynogenMod 10.2.
Tim Veluwenkamp announced a new version of CL yesterday that may address the issue but I am not sure about it. I am on CM10.2 now.

Failed to inflate only on prod

Hello i have upload my new application to the google play store.
When i download my app from the play store and open it i got this error:
0-10 09:05:21.605: W/dalvikvm(22966): method Lorg/holoeverywhere/widget/aw;.getVirtualChildCount incorrectly overrides package-private method with same name in Landroid/widget/LinearLayout;
10-10 09:05:21.715: W/dalvikvm(22966): method Lorg/holoeverywhere/widget/ProgressBar;.getCurrentDrawable incorrectly overrides package-private method with same name in Landroid/widget/ProgressBar;
10-10 09:05:21.725: E/ActivityThread(22966): Failed to inflate
10-10 09:05:21.725: E/ActivityThread(22966): android.view.InflateException: Binary XML file line #22: Error inflating class org.holoeverywhere.widget.ProgressBar
10-10 09:05:21.725: E/ActivityThread(22966): at org.holoeverywhere.k.a(Unknown Source)
10-10 09:05:21.725: E/ActivityThread(22966): at org.holoeverywhere.k.onCreateView(Unknown Source)
10-10 09:05:21.725: E/ActivityThread(22966): at org.holoeverywhere.k.a(Unknown Source)
10-10 09:05:21.725: E/ActivityThread(22966): at org.holoeverywhere.k.a(Unknown Source)
10-10 09:05:21.725: E/ActivityThread(22966): at org.holoeverywhere.k.inflate(Unknown Source)
10-10 09:05:21.725: E/ActivityThread(22966): at org.holoeverywhere.k.inflate(Unknown Source)
10-10 09:05:21.725: E/ActivityThread(22966): at android.support.v4.app._HoloActivity.a(Unknown Source)
10-10 09:05:21.725: E/ActivityThread(22966): at android.support.v4.app._HoloActivity.setContentView(Unknown Source)
10-10 09:05:21.725: E/ActivityThread(22966): at com.example.workoutlog.OpeningPage.onCreate(Unknown Source)
10-10 09:05:21.725: E/ActivityThread(22966): at android.app.Activity.performCreate(Activity.java:5104)
10-10 09:05:21.725: E/ActivityThread(22966): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
10-10 09:05:21.725: E/ActivityThread(22966): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2262)
10-10 09:05:21.725: E/ActivityThread(22966): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
10-10 09:05:21.725: E/ActivityThread(22966): at android.app.ActivityThread.access$600(ActivityThread.java:153)
10-10 09:05:21.725: E/ActivityThread(22966): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
10-10 09:05:21.725: E/ActivityThread(22966): at android.os.Handler.dispatchMessage(Handler.java:99)
10-10 09:05:21.725: E/ActivityThread(22966): at android.os.Looper.loop(Looper.java:137)
10-10 09:05:21.725: E/ActivityThread(22966): at android.app.ActivityThread.main(ActivityThread.java:5227)
10-10 09:05:21.725: E/ActivityThread(22966): at java.lang.reflect.Method.invokeNative(Native Method)
10-10 09:05:21.725: E/ActivityThread(22966): at java.lang.reflect.Method.invoke(Method.java:511)
10-10 09:05:21.725: E/ActivityThread(22966): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
10-10 09:05:21.725: E/ActivityThread(22966): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
10-10 09:05:21.725: E/ActivityThread(22966): at dalvik.system.NativeStart.main(Native Method)
10-10 09:05:21.725: E/ActivityThread(22966): Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet]
10-10 09:05:21.725: E/ActivityThread(22966): at java.lang.Class.getConstructorOrMethod(Class.java:460)
10-10 09:05:21.725: E/ActivityThread(22966): at java.lang.Class.getConstructor(Class.java:431)
10-10 09:05:21.725: E/ActivityThread(22966): ... 23 more
10-10 09:05:21.755: D/AndroidRuntime(22966): Shutting down VM
10-10 09:05:21.755: W/dalvikvm(22966): threadid=1: thread exiting with uncaught exception (group=0x41f86930)
10-10 09:05:21.755: E/AndroidRuntime(22966): FATAL EXCEPTION: main
10-10 09:05:21.755: E/AndroidRuntime(22966): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tigo/com.example.workoutlog.OpeningPage}: android.view.InflateException: Binary XML file line #22: Error inflating class org.holoeverywhere.widget.ProgressBar
10-10 09:05:21.755: E/AndroidRuntime(22966): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308)
10-10 09:05:21.755: E/AndroidRuntime(22966): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
10-10 09:05:21.755: E/AndroidRuntime(22966): at android.app.ActivityThread.access$600(ActivityThread.java:153)
10-10 09:05:21.755: E/AndroidRuntime(22966): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
10-10 09:05:21.755: E/AndroidRuntime(22966): at android.os.Handler.dispatchMessage(Handler.java:99)
10-10 09:05:21.755: E/AndroidRuntime(22966): at android.os.Looper.loop(Looper.java:137)
10-10 09:05:21.755: E/AndroidRuntime(22966): at android.app.ActivityThread.main(ActivityThread.java:5227)
10-10 09:05:21.755: E/AndroidRuntime(22966): at java.lang.reflect.Method.invokeNative(Native Method)
10-10 09:05:21.755: E/AndroidRuntime(22966): at java.lang.reflect.Method.invoke(Method.java:511)
10-10 09:05:21.755: E/AndroidRuntime(22966): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
10-10 09:05:21.755: E/AndroidRuntime(22966): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
10-10 09:05:21.755: E/AndroidRuntime(22966): at dalvik.system.NativeStart.main(Native Method)
10-10 09:05:21.755: E/AndroidRuntime(22966): Caused by: android.view.InflateException: Binary XML file line #22: Error inflating class org.holoeverywhere.widget.ProgressBar
10-10 09:05:21.755: E/AndroidRuntime(22966): at org.holoeverywhere.k.a(Unknown Source)
10-10 09:05:21.755: E/AndroidRuntime(22966): at org.holoeverywhere.k.onCreateView(Unknown Source)
10-10 09:05:21.755: E/AndroidRuntime(22966): at org.holoeverywhere.k.a(Unknown Source)
10-10 09:05:21.755: E/AndroidRuntime(22966): at org.holoeverywhere.k.a(Unknown Source)
10-10 09:05:21.755: E/AndroidRuntime(22966): at org.holoeverywhere.k.inflate(Unknown Source)
10-10 09:05:21.755: E/AndroidRuntime(22966): at org.holoeverywhere.k.inflate(Unknown Source)
10-10 09:05:21.755: E/AndroidRuntime(22966): at android.support.v4.app._HoloActivity.a(Unknown Source)
10-10 09:05:21.755: E/AndroidRuntime(22966): at android.support.v4.app._HoloActivity.setContentView(Unknown Source)
10-10 09:05:21.755: E/AndroidRuntime(22966): at com.example.workoutlog.OpeningPage.onCreate(Unknown Source)
10-10 09:05:21.755: E/AndroidRuntime(22966): at android.app.Activity.performCreate(Activity.java:5104)
10-10 09:05:21.755: E/AndroidRuntime(22966): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
10-10 09:05:21.755: E/AndroidRuntime(22966): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2262)
10-10 09:05:21.755: E/AndroidRuntime(22966): ... 11 more
10-10 09:05:21.755: E/AndroidRuntime(22966): Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet]
10-10 09:05:21.755: E/AndroidRuntime(22966): at java.lang.Class.getConstructorOrMethod(Class.java:460)
10-10 09:05:21.755: E/AndroidRuntime(22966): at java.lang.Class.getConstructor(Class.java:431)
10-10 09:05:21.755: E/AndroidRuntime(22966): ... 23 more
When i run the application from eclispe i dont get any of this error and everyting just running fine.
I think its the pro guard i added the my app but im not sure.
Here is my pro gurad settings:
proguard-project.txt:
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-dontwarn com.google.**
-dontwarn org.apache.**
-dontwarn twitter4j.**
project.properties
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-18
android.library.reference.1=..\\Application\\Libs android\\actionbarsherlock
android.library.reference.2=..\\Application\\Libs android\\facebook-android-sdk-3.5\\facebook
android.library.reference.3=..\\Application\\Libs android\\AmbilWarna
android.library.reference.4=..\\Application\\Libs android\\HoloEverywhere-master\\addons\\preferences
android.library.reference.5=..\\Application\\Libs android\\HoloEverywhere-master\\library
android.library.reference.6=../Application/Libs android/google-play-services_lib
Thank for helping!

Zxing CaptureActivity - crashing when launching activity

I am trying to integrate the QR reading capabilities of Zxing into a stand-alone app, and have been using this very helpful guide http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/ along with these pointers Integrating the ZXing library directly into my Android application but after having built the library, and followed all steps to launch this activity on a button press, it still does not work. The app launches, but upon pressing the button, it crashes.
activity_main.html
<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"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="buttPress"
android:text="#string/button_send"
android:textColor="#FFFFFF"
/>
</RelativeLayout>
MainActivity.java
package se.mydomain.myapp;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public void buttPress(View view) {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
}
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
String contents = intent.getStringExtra("SCAN_RESULT");
String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
// Handle successful scan
} else if (resultCode == RESULT_CANCELED) {
// Handle cancel
}
}
}
}
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="se.mydomain.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.CAMERA"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="se.mydomain.myapp.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.zxing.client.android.CaptureActivity"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<intent-filter>
<action android:name="com.google.zxing.client.android.SCAN"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>
This is the output in logcat upon launching and then pressing the button. Am I missing something obvious here? This happens both when emulating and when running on a phone, btw.
04-16 13:31:58.313: D/gralloc_goldfish(1359): Emulator without GPU emulation detected.
04-16 13:32:13.034: I/Choreographer(1359): Skipped 82 frames! The application may be doing too much work on its main thread.
04-16 13:32:13.093: W/dalvikvm(1359): VFY: unable to resolve static field 872 (ISSUE_NUMBER) in Lcom/google/zxing/ResultMetadataType;
04-16 13:32:13.103: D/dalvikvm(1359): VFY: replacing opcode 0x62 at 0x0017
04-16 13:32:13.103: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.133: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/ResultPoint;)
04-16 13:32:13.133: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/ResultPoint;)
04-16 13:32:13.133: I/dalvikvm(1359): Could not find method com.google.zxing.ResultPoint.getX, referenced from method com.google.zxing.client.android.CaptureActivity.drawLine
04-16 13:32:13.143: W/dalvikvm(1359): VFY: unable to resolve virtual method 3648: Lcom/google/zxing/ResultPoint;.getX ()F
04-16 13:32:13.143: D/dalvikvm(1359): VFY: replacing opcode 0x6e at 0x0000
04-16 13:32:13.143: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.175: I/dalvikvm(1359): Could not find method com.google.zxing.Result.getResultPoints, referenced from method com.google.zxing.client.android.CaptureActivity.drawResultPoints
04-16 13:32:13.175: W/dalvikvm(1359): VFY: unable to resolve virtual method 3644: Lcom/google/zxing/Result;.getResultPoints ()[Lcom/google/zxing/ResultPoint;
04-16 13:32:13.183: D/dalvikvm(1359): VFY: replacing opcode 0x6e at 0x0003
04-16 13:32:13.183: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.224: I/dalvikvm(1359): Could not find method com.google.zxing.Result.toString, referenced from method com.google.zxing.client.android.CaptureActivity.handleDecodeExternally
04-16 13:32:13.224: W/dalvikvm(1359): VFY: unable to resolve virtual method 3647: Lcom/google/zxing/Result;.toString ()Ljava/lang/String;
04-16 13:32:13.224: D/dalvikvm(1359): VFY: replacing opcode 0x74 at 0x007d
04-16 13:32:13.253: I/dalvikvm(1359): Could not find method com.google.zxing.Result.getText, referenced from method com.google.zxing.client.android.CaptureActivity.handleDecodeExternally
04-16 13:32:13.253: W/dalvikvm(1359): VFY: unable to resolve virtual method 3645: Lcom/google/zxing/Result;.getText ()Ljava/lang/String;
04-16 13:32:13.264: D/dalvikvm(1359): VFY: replacing opcode 0x74 at 0x01c0
04-16 13:32:13.264: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.284: I/dalvikvm(1359): Could not find method com.google.zxing.Result.getBarcodeFormat, referenced from method com.google.zxing.client.android.CaptureActivity.handleDecodeInternally
04-16 13:32:13.284: W/dalvikvm(1359): VFY: unable to resolve virtual method 3641: Lcom/google/zxing/Result;.getBarcodeFormat ()Lcom/google/zxing/BarcodeFormat;
04-16 13:32:13.284: D/dalvikvm(1359): VFY: replacing opcode 0x74 at 0x004c
04-16 13:32:13.324: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.354: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.364: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.384: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.384: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.394: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.394: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.414: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.454: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.454: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.484: I/dalvikvm(1359): Could not find method com.google.zxing.Result.getText, referenced from method com.google.zxing.client.android.CaptureActivity.handleDecode
04-16 13:32:13.494: W/dalvikvm(1359): VFY: unable to resolve virtual method 3645: Lcom/google/zxing/Result;.getText ()Ljava/lang/String;
04-16 13:32:13.494: D/dalvikvm(1359): VFY: replacing opcode 0x6e at 0x0068
04-16 13:32:13.504: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.504: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.524: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.574: W/dalvikvm(1359): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/google/zxing/client/android/CaptureActivity;
04-16 13:32:13.584: W/dalvikvm(1359): Class init failed in newInstance call (Lcom/google/zxing/client/android/CaptureActivity;)
04-16 13:32:13.584: D/AndroidRuntime(1359): Shutting down VM
04-16 13:32:13.594: W/dalvikvm(1359): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
04-16 13:32:13.664: E/AndroidRuntime(1359): FATAL EXCEPTION: main
04-16 13:32:13.664: E/AndroidRuntime(1359): java.lang.ExceptionInInitializerError
04-16 13:32:13.664: E/AndroidRuntime(1359): at java.lang.Class.newInstanceImpl(Native Method)
04-16 13:32:13.664: E/AndroidRuntime(1359): at java.lang.Class.newInstance(Class.java:1319)
04-16 13:32:13.664: E/AndroidRuntime(1359): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
04-16 13:32:13.664: E/AndroidRuntime(1359): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
04-16 13:32:13.664: E/AndroidRuntime(1359): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
04-16 13:32:13.664: E/AndroidRuntime(1359): at android.app.ActivityThread.access$600(ActivityThread.java:141)
04-16 13:32:13.664: E/AndroidRuntime(1359): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
04-16 13:32:13.664: E/AndroidRuntime(1359): at android.os.Handler.dispatchMessage(Handler.java:99)
04-16 13:32:13.664: E/AndroidRuntime(1359): at android.os.Looper.loop(Looper.java:137)
04-16 13:32:13.664: E/AndroidRuntime(1359): at android.app.ActivityThread.main(ActivityThread.java:5041)
04-16 13:32:13.664: E/AndroidRuntime(1359): at java.lang.reflect.Method.invokeNative(Native Method)
04-16 13:32:13.664: E/AndroidRuntime(1359): at java.lang.reflect.Method.invoke(Method.java:511)
04-16 13:32:13.664: E/AndroidRuntime(1359): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-16 13:32:13.664: E/AndroidRuntime(1359): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-16 13:32:13.664: E/AndroidRuntime(1359): at dalvik.system.NativeStart.main(Native Method)
04-16 13:32:13.664: E/AndroidRuntime(1359): Caused by: java.lang.NoClassDefFoundError: com.google.zxing.ResultMetadataType
04-16 13:32:13.664: E/AndroidRuntime(1359): at com.google.zxing.client.android.CaptureActivity.<clinit>(CaptureActivity.java:101)
04-16 13:32:13.664: E/AndroidRuntime(1359): ... 15 more
04-16 13:32:19.034: I/Process(1359): Sending signal. PID: 1359 SIG: 9

Google Calendar API error: Class definition not found for Calendar class

Hello everybody,
I am developing a app which will download all the events from google calendar to android device.
I found this example:
http://code.google.com/p/google-api-java-client/source/browse/calendar-android-sample/?repo=samples
I also downloaded the required library from http://code.google.com/p/google-api-java-client/wiki/APIs
Also from here : "http://code.google.com/p/google-api-java-client/downloads/list"
But I am getting error as class definition not found. Please help me.
My Logcat is as follows:
***10-10 12:52:10.129: E/dalvikvm(551): Could not find class 'com.google.api.services.calendar.Calendar$Builder', referenced from method com.examples.gcalsync.CalendarSample.onCreate***
10-10 12:52:10.129: W/dalvikvm(551): VFY: unable to resolve new-instance 702 (Lcom/google/api/services/calendar/Calendar$Builder;) in Lcom/examples/gcalsync/CalendarSample;
10-10 12:52:10.129: D/dalvikvm(551): VFY: replacing opcode 0x22 at 0x0009
10-10 12:52:10.129: D/dalvikvm(551): VFY: dead code 0x000b-0060 in Lcom/examples/gcalsync/CalendarSample;.onCreate (Landroid/os/Bundle;)V
10-10 12:52:10.139: E/dalvikvm(551): Could not find class 'com.google.api.services.calendar.model.Calendar', referenced from method com.examples.gcalsync.CalendarSample.onOptionsItemSelected
10-10 12:52:10.139: W/dalvikvm(551): VFY: unable to resolve new-instance 710 (Lcom/google/api/services/calendar/model/Calendar;) in Lcom/examples/gcalsync/CalendarSample;
10-10 12:52:10.139: D/dalvikvm(551): VFY: replacing opcode 0x22 at 0x000b
10-10 12:52:10.139: D/dalvikvm(551): VFY: dead code 0x000d-0036 in Lcom/examples/gcalsync/CalendarSample;.onOptionsItemSelected (Landroid/view/MenuItem;)Z
10-10 12:52:10.179: D/AndroidRuntime(551): Shutting down VM
10-10 12:52:10.179: W/dalvikvm(551): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
10-10 12:52:10.199: E/AndroidRuntime(551): FATAL EXCEPTION: main
***10-10 12:52:10.199: E/AndroidRuntime(551): java.lang.NoClassDefFoundError: com.google.api.services.calendar.Calendar$Builder***
10-10 12:52:10.199: E/AndroidRuntime(551): at com.examples.gcalsync.CalendarSample.onCreate(CalendarSample.java:127)
10-10 12:52:10.199: E/AndroidRuntime(551): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-10 12:52:10.199: E/AndroidRuntime(551): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
10-10 12:52:10.199: E/AndroidRuntime(551): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
10-10 12:52:10.199: E/AndroidRuntime(551): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
10-10 12:52:10.199: E/AndroidRuntime(551): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
10-10 12:52:10.199: E/AndroidRuntime(551): at android.os.Handler.dispatchMessage(Handler.java:99)
10-10 12:52:10.199: E/AndroidRuntime(551): at android.os.Looper.loop(Looper.java:123)
10-10 12:52:10.199: E/AndroidRuntime(551): at android.app.ActivityThread.main(ActivityThread.java:4627)
10-10 12:52:10.199: E/AndroidRuntime(551): at java.lang.reflect.Method.invokeNative(Native Method)
10-10 12:52:10.199: E/AndroidRuntime(551): at java.lang.reflect.Method.invoke(Method.java:521)
10-10 12:52:10.199: E/AndroidRuntime(551): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
10-10 12:52:10.199: E/AndroidRuntime(551): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
10-10 12:52:10.199: E/AndroidRuntime(551): at dalvik.system.NativeStart.main(Native Method)
Issue got solved.
Just need to put all external libraries in libs folder....

Categories

Resources