using youtube data in android project - android

My target is to use youtube instead of server, to store videos.
I need youtube provide the following function
1. upload video and get his url .
2. search for video that match developer tag.
to do so, i find here those posts
Using YouTube Data Api in Android
Creating a playlist with Youtube DATA API on Android
after i read those posts i install eclipse youtube data plug in
and downloaded those file
https://code.google.com/p/gdata-java-client/downloads/detail?name=gdata-samples.java-1.47.1.zip&can=2&q=
gdata-samples.java-1.47.1
mail.jar
activation.jar
servlet-api.jar
as mention here
https://developers.google.com/gdata/articles/eclipse?hl=iw
those zip file i add to libs folder on my android project exactly like youtube mention in the link above...
to my project i add internet permission, import packages, and add this line :
YouTubeService service = new YouTubeService(clientID, developer_key);
like mention here :
https://developers.google.com/youtube/2.0/developers_guide_java?hl=iw#Authentication
in this time my project look like this :
package com.example.youtubeuploaddata;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import com.google.gdata.client.*;
import com.google.gdata.client.youtube.*;
import com.google.gdata.data.*;
import com.google.gdata.data.geo.impl.*;
import com.google.gdata.data.media.*;
import com.google.gdata.data.media.mediarss.*;
import com.google.gdata.data.youtube.*;
import com.google.gdata.data.extensions.*;
import com.google.gdata.util.*;
import java.io.IOException;
import java.io.File;
import java.net.URL;
public class YoutubeUploadData extends Activity {
String clientID = "xxxxxxxxxxxxxxx";
String developer_key = "xxxxxxxxxxxxxxxxxxxxxxx";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_youtube_upload_data);
YouTubeService service = new YouTubeService(clientID, developer_key);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.youtube_upload_data, menu);
return true;
}
}
and my project contein this jar
at this time i test the app on my device and recieve those errors :
05-01 21:10:43.993: W/dalvikvm(12171): Unable to resolve superclass of Lcom/google/gdata/util/common/net/UriParameterMap; (26)
05-01 21:10:43.993: W/dalvikvm(12171): Link of class 'Lcom/google/gdata/util/common/net/UriParameterMap;' failed
05-01 21:10:43.993: W/dalvikvm(12171): VFY: unable to find class referenced in signature (Lcom/google/gdata/util/common/net/UriParameterMap;)
05-01 21:10:43.993: W/dalvikvm(12171): Unable to resolve superclass of Lcom/google/gdata/util/common/net/UriParameterMap; (26)
05-01 21:10:43.993: W/dalvikvm(12171): Link of class 'Lcom/google/gdata/util/common/net/UriParameterMap;' failed
05-01 21:10:43.993: W/dalvikvm(12171): VFY: unable to find class referenced in signature (Lcom/google/gdata/util/common/net/UriParameterMap;)
05-01 21:10:43.993: W/dalvikvm(12171): Unable to resolve superclass of Lcom/google/gdata/util/common/net/UriParameterMap; (26)
05-01 21:10:44.003: W/dalvikvm(12171): Link of class 'Lcom/google/gdata/util/common/net/UriParameterMap;' failed
05-01 21:10:44.003: W/dalvikvm(12171): VFY: unable to resolve static field 2621 (EMPTY_MAP) in Lcom/google/gdata/util/common/net/UriParameterMap;
05-01 21:10:44.003: W/dalvikvm(12171): Unable to resolve superclass of Lcom/google/gdata/util/common/net/UriParameterMap; (26)
05-01 21:10:44.003: W/dalvikvm(12171): Link of class 'Lcom/google/gdata/util/common/net/UriParameterMap;' failed
05-01 21:10:44.003: W/dalvikvm(12171): VFY: unable to resolve static method 8229: Lcom/google/gdata/util/common/net/UriParameterMap;.parse (Ljava/lang/String;)Lcom/google/gdata/util/common/net/UriParameterMap;
05-01 21:10:44.033: W/dalvikvm(12171): VFY: unable to resolve static method 65: Lcom/google/common/collect/Maps;.newHashMap (Ljava/util/Map;)Ljava/util/HashMap;
05-01 21:10:44.033: W/dalvikvm(12171): VFY: unable to resolve static method 64: Lcom/google/common/collect/Maps;.newHashMap ()Ljava/util/HashMap;
05-01 21:10:44.033: W/dalvikvm(12171): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/google/gdata/client/Service;
05-01 21:10:44.033: W/dalvikvm(12171): threadid=1: thread exiting with uncaught exception (group=0x40d9f1f8)
05-01 21:10:44.043: E/AndroidRuntime(12171): FATAL EXCEPTION: main
05-01 21:10:44.043: E/AndroidRuntime(12171): java.lang.ExceptionInInitializerError
05-01 21:10:44.043: E/AndroidRuntime(12171): at com.example.youtubeuploaddata.YoutubeUploadData.onCreate(YoutubeUploadData.java:55)
05-01 21:10:44.043: E/AndroidRuntime(12171): at android.app.Activity.performCreate(Activity.java:4519)
05-01 21:10:44.043: E/AndroidRuntime(12171): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-01 21:10:44.043: E/AndroidRuntime(12171): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
05-01 21:10:44.043: E/AndroidRuntime(12171): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-01 21:10:44.043: E/AndroidRuntime(12171): at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-01 21:10:44.043: E/AndroidRuntime(12171): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-01 21:10:44.043: E/AndroidRuntime(12171): at android.os.Handler.dispatchMessage(Handler.java:99)
05-01 21:10:44.043: E/AndroidRuntime(12171): at android.os.Looper.loop(Looper.java:137)
05-01 21:10:44.043: E/AndroidRuntime(12171): at android.app.ActivityThread.main(ActivityThread.java:4464)
05-01 21:10:44.043: E/AndroidRuntime(12171): at java.lang.reflect.Method.invokeNative(Native Method)
05-01 21:10:44.043: E/AndroidRuntime(12171): at java.lang.reflect.Method.invoke(Method.java:511)
05-01 21:10:44.043: E/AndroidRuntime(12171): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:822)
05-01 21:10:44.043: E/AndroidRuntime(12171): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:589)
05-01 21:10:44.043: E/AndroidRuntime(12171): at dalvik.system.NativeStart.main(Native Method)
05-01 21:10:44.043: E/AndroidRuntime(12171): Caused by: java.lang.NoClassDefFoundError: com.google.common.collect.Maps
05-01 21:10:44.043: E/AndroidRuntime(12171): at com.google.gdata.wireformats.AltRegistry.<init>(AltRegistry.java:118)
05-01 21:10:44.043: E/AndroidRuntime(12171): at com.google.gdata.wireformats.AltRegistry.<init>(AltRegistry.java:100)
05-01 21:10:44.043: E/AndroidRuntime(12171): at com.google.gdata.client.Service.<clinit>(Service.java:555)
05-01 21:10:44.043: E/AndroidRuntime(12171): ... 15 more
in this state i understand that, youtube data not work on android project
what i need to do to order this target???
please help...

Your problem is this:
Caused by: java.lang.NoClassDefFoundError: com.google.common.collect.Maps
com.google.common.collect.Maps is not found. You ether missing a library or have some problem with the manifest.

Feel free to go through my example open source project, it utilizes Data API v3 for this..
https://code.google.com/p/ytd-android/

Related

can we use owasp-ESAPI for logging android application?

can we use owasp-ESAPI for logging android application, as I have tried to search on google and then as per my understanding I found OWASP-ESAPI can be used with JAVA-EE.
can someone help me to integrate secure logger with OWASP-ESAPI on android application?
For better understanding my problem please go though following :
"esapi-2.1.0.jar" allow us to write
Following code that I am trying:
private final Logger logger = ESAPI.getLogger(MyActivity.class.getName());
logger.error(Logger.SECURITY_FAILURE, "session has expired, log out user");
when I run my project it gives following on logcat:
05-01 13:02:52.455: D/ResourcesManager(9936): creating new AssetManager and set to /data/app/com.example.loggerlatestjar-1/base.apk
05-01 13:02:52.555: I/System.out(9936): Attempting to load ESAPI.properties via file I/O.
05-01 13:02:52.555: I/System.out(9936): Attempting to load ESAPI.properties as resource file via file I/O.
05-01 13:02:52.555: I/System.out(9936): Not found in 'org.owasp.esapi.resources' directory or file not readable: /ESAPI.properties
05-01 13:02:52.565: I/System.out(9936): Not found in SystemResource Directory/resourceDirectory: .esapi/ESAPI.properties
05-01 13:02:52.565: I/System.out(9936): Not found in 'user.home' () directory: /esapi/ESAPI.properties
05-01 13:02:52.565: I/System.out(9936): Loading ESAPI.properties via file I/O failed. Exception was: java.io.FileNotFoundException
05-01 13:02:52.565: I/System.out(9936): Attempting to load ESAPI.properties via the classpath.
05-01 13:02:52.615: I/System.out(9936): ESAPI.properties could not be loaded by any means. Fail. Exception was: java.lang.IllegalArgumentException: Failed to load ESAPI.properties as a classloader resource.
05-01 13:02:52.615: D/AndroidRuntime(9936): Shutting down VM
05-01 13:02:52.620: E/AndroidRuntime(9936): FATAL EXCEPTION: main
05-01 13:02:52.620: E/AndroidRuntime(9936): Process: com.example.loggerlatestjar, PID: 9936
05-01 13:02:52.620: E/AndroidRuntime(9936): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.loggerlatestjar/com.example.loggerlatestjar.MainActivity}: org.owasp.esapi.errors.ConfigurationException: java.lang.reflect.InvocationTargetException SecurityConfiguration class (org.owasp.esapi.reference.DefaultSecurityConfiguration) CTOR threw exception.
05-01 13:02:52.620: E/AndroidRuntime(9936): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2702)
05-01 13:02:52.620: E/AndroidRuntime(9936): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
05-01 13:02:52.620: E/AndroidRuntime(9936): at android.app.ActivityThread.access$900(ActivityThread.java:177)
05-01 13:02:52.620: E/AndroidRuntime(9936): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
05-01 13:02:52.620: E/AndroidRuntime(9936): at android.os.Handler.dispatchMessage(Handler.java:102)
05-01 13:02:52.620: E/AndroidRuntime(9936): at android.os.Looper.loop(Looper.java:145)
05-01 13:02:52.620: E/AndroidRuntime(9936): at android.app.ActivityThread.main(ActivityThread.java:5951)
05-01 13:02:52.620: E/AndroidRuntime(9936): at java.lang.reflect.Method.invoke(Native Method)
05-01 13:02:52.620: E/AndroidRuntime(9936): at java.lang.reflect.Method.invoke(Method.java:372)
05-01 13:02:52.620: E/AndroidRuntime(9936): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
05-01 13:02:52.620: E/AndroidRuntime(9936): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
05-01 13:02:52.620: E/AndroidRuntime(9936): Caused by: org.owasp.esapi.errors.ConfigurationException: java.lang.reflect.InvocationTargetException SecurityConfiguration class (org.owasp.esapi.reference.DefaultSecurityConfiguration) CTOR threw exception.
05-01 13:02:52.620: E/AndroidRuntime(9936): at org.owasp.esapi.util.ObjFactory.make(ObjFactory.java:129)
05-01 13:02:52.620: E/AndroidRuntime(9936): at org.owasp.esapi.ESAPI.securityConfiguration(ESAPI.java:184)
05-01 13:02:52.620: E/AndroidRuntime(9936): at org.owasp.esapi.ESAPI.logFactory(ESAPI.java:137)
05-01 13:02:52.620: E/AndroidRuntime(9936): at org.owasp.esapi.ESAPI.getLogger(ESAPI.java:154)
05-01 13:02:52.620: E/AndroidRuntime(9936): at com.example.loggerlatestjar.MainActivity.onCreate(MainActivity.java:23)
05-01 13:02:52.620: E/AndroidRuntime(9936): at android.app.Activity.performCreate(Activity.java:6289)
05-01 13:02:52.620: E/AndroidRuntime(9936): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
05-01 13:02:52.620: E/AndroidRuntime(9936): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655)
05-01 13:02:52.620: E/AndroidRuntime(9936): ... 10 more
05-01 13:02:52.620: E/AndroidRuntime(9936): Caused by: java.lang.reflect.InvocationTargetException
05-01 13:02:52.620: E/AndroidRuntime(9936): at java.lang.reflect.Method.invoke(Native Method)
05-01 13:02:52.620: E/AndroidRuntime(9936): at java.lang.reflect.Method.invoke(Method.java:372)
05-01 13:02:52.620: E/AndroidRuntime(9936): at org.owasp.esapi.util.ObjFactory.make(ObjFactory.java:86)
05-01 13:02:52.620: E/AndroidRuntime(9936): ... 17 more
05-01 13:02:52.620: E/AndroidRuntime(9936): Caused by: org.owasp.esapi.errors.ConfigurationException: ESAPI.properties could not be loaded by any means. Fail.
05-01 13:02:52.620: E/AndroidRuntime(9936): at org.owasp.esapi.reference.DefaultSecurityConfiguration.loadConfiguration(DefaultSecurityConfiguration.java:439)
05-01 13:02:52.620: E/AndroidRuntime(9936): at org.owasp.esapi.reference.DefaultSecurityConfiguration.<init>(DefaultSecurityConfiguration.java:227)
05-01 13:02:52.620: E/AndroidRuntime(9936): at org.owasp.esapi.reference.DefaultSecurityConfiguration.getInstance(DefaultSecurityConfiguration.java:75)
05-01 13:02:52.620: E/AndroidRuntime(9936): ... 20 more
05-01 13:02:52.620: E/AndroidRuntime(9936): Caused by: java.lang.IllegalArgumentException: Failed to load ESAPI.properties as a classloader resource.
05-01 13:02:52.620: E/AndroidRuntime(9936): at org.owasp.esapi.reference.DefaultSecurityConfiguration.loadConfigurationFromClasspath(DefaultSecurityConfiguration.java:667)
05-01 13:02:52.620: E/AndroidRuntime(9936): at org.owasp.esapi.reference.DefaultSecurityConfiguration.loadConfiguration(DefaultSecurityConfiguration.java:436)
05-01 13:02:52.620: E/AndroidRuntime(9936): ... 22 more
Note : I am not using ESAPI.property file. because i do not know how to use it in android app.

Sending an automatic email

Hi im trying to follow this tutorial
I followed all the steps and when i try to execute the app i get the following error:
03-14 17:24:19.618 3532-3532/ar.com.taxiexpress.taxiexpress E/dalvikvm: Could not find class 'ar.com.taxiexpress.taxiexpress.Mail', referenced from method ar.com.taxiexpress.taxiexpress.EnvioMail$SendMail.doInBackground
03-14 17:24:19.618 3532-3532/ar.com.taxiexpress.taxiexpress W/dalvikvm: VFY: unable to resolve new-instance 2544 (Lar/com/taxiexpress/taxiexpress/Mail;) in Lar/com/taxiexpress/taxiexpress/EnvioMail$SendMail;
03-14 17:24:19.618 3532-3532/ar.com.taxiexpress.taxiexpress D/dalvikvm: VFY: replacing opcode 0x22 at 0x0001
03-14 17:24:19.618 3532-3532/ar.com.taxiexpress.taxiexpress W/dalvikvm: Unable to resolve superclass of Lar/com/taxiexpress/taxiexpress/Mail; (9576)
03-14 17:24:19.618 3532-3532/ar.com.taxiexpress.taxiexpress W/dalvikvm: Link of class 'Lar/com/taxiexpress/taxiexpress/Mail;' failed
03-14 17:24:19.618 3532-3532/ar.com.taxiexpress.taxiexpress D/dalvikvm: DexOpt: unable to opt direct call 0x51e4 at 0x07 in Lar/com/taxiexpress/taxiexpress/EnvioMail$SendMail;.doInBackground
03-14 17:24:19.650 3532-3676/ar.com.taxiexpress.taxiexpress W/dalvikvm: threadid=17: thread exiting with uncaught exception (group=0xa4d31b20)
03-14 17:24:19.650 3532-3676/ar.com.taxiexpress.taxiexpress E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #3
Process: ar.com.taxiexpress.taxiexpress, PID: 3532
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.NoClassDefFoundError: ar.com.taxiexpress.taxiexpress.Mail
at ar.com.taxiexpress.taxiexpress.EnvioMail$SendMail.doInBackground(EnvioMail.java:51)
at ar.com.taxiexpress.taxiexpress.EnvioMail$SendMail.doInBackground(EnvioMail.java:34)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
at java.lang.Thread.run(Thread.java:841) 
03-14 17:24:19.678 3532-3532/ar.com.taxiexpress.taxiexpress W/EGL_genymotion: eglSurfaceAttrib not implemented
03-14 17:24:19.854 3532-3532/ar.com.taxiexpress.taxiexpress W/EGL_genymotion: eglSurfaceAttrib not implemented
03-14 17:24:20.382 3532-3546/ar.com.taxiexpress.taxiexpress I/GMPM: Tag Manager is not found and thus will not be used
03-14 17:27:01.184 3532-3538/ar.com.taxiexpress.taxiexpress D/dalvikvm: GC_FOR_ALLOC freed 305K, 3% free 16909K/17288K, paused 8ms, total 8ms
03-14 17:29:19.670 3532-3676/ar.com.taxiexpress.taxiexpress I/Process: Sending signal. PID: 3532 SIG: 9
could someone tell me what should I check to resolve this issue, thanks in advance.

AdMob making my app crash in release version

i just added AdMob to my app. Everything seem to work well when i debug or install release version of app (HTC m7). The problem occurs on CHUWI VX2 device (esky82_tb_cn_kk, Android 4.4). It is very strange because on this device my App works in debug mode but doesn't works in release version. I try turn of pro-gourd but it doesn't help me.
Any one have idea for that?
my manifest
instruction inside my onCreate method:
mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.setAdListener(new AdListener() {
#Override
public void onAdClosed() {
super.onAdClosed();
mAdView.setVisibility(View.GONE);
}
#Override
public void onAdOpened() {
super.onAdOpened();
mAdView.startAnimation(fade_in);
mAdView.setVisibility(View.VISIBLE);
}
#Override
public void onAdFailedToLoad(int errorCode) {
super.onAdFailedToLoad(errorCode);
mAdView.setVisibility(View.GONE);
}
#Override
public void onAdLoaded() {
super.onAdLoaded();
mAdView.startAnimation(fade_in);
mAdView.setVisibility(View.VISIBLE);
}
#Override
public void onAdLeftApplication() {
super.onAdLeftApplication();
mAdView.setVisibility(View.GONE);
}
});
mAdView.loadAd(adRequest);
code inside layout.xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.google.android.gms.ads.AdView android:id="#+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
ads:adSize="SMART_BANNER"
ads:adUnitId="#string/banner_ad_unit_id"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:visibility="gone">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
Crash log:
05-01 19:39:16.305 124-124/? I/SurfaceFlinger﹕ Skip composition for [Built-in Screen (type:0)] since dirtyRegion is empty
05-01 19:39:16.321 124-124/? I/SurfaceFlinger﹕ Skip composition for [Built-in Screen (type:0)] since dirtyRegion is empty
05-01 19:39:16.330 2162-2162/? D/AndroidRuntime﹕ Shutting down VM
05-01 19:39:16.330 2162-2162/? W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41d79c98)
05-01 19:39:16.330 2162-2162/? W/dalvikvm﹕ threadid=1: uncaught exception occurred
05-01 19:39:16.331 2162-2162/? W/System.err﹕ java.lang.RuntimeException: Unable to start activity ComponentInfo{freshfrog.pytomat/freshfrog.pytomat.Main}: java.lang.NullPointerException
05-01 19:39:16.332 2162-2162/? W/System.err﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2338)
05-01 19:39:16.332 2162-2162/? W/System.err﹕ at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
05-01 19:39:16.332 2162-2162/? W/System.err﹕ at android.app.ActivityThread.access$800(ActivityThread.java:151)
05-01 19:39:16.332 2162-2162/? W/System.err﹕ at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
05-01 19:39:16.332 2162-2162/? W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:110)
05-01 19:39:16.332 2162-2162/? W/System.err﹕ at android.os.Looper.loop(Looper.java:193)
05-01 19:39:16.333 2162-2162/? W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5292)
05-01 19:39:16.333 2162-2162/? W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
05-01 19:39:16.333 2162-2162/? W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:515)
05-01 19:39:16.333 2162-2162/? W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
05-01 19:39:16.333 2162-2162/? W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
05-01 19:39:16.333 2162-2162/? W/System.err﹕ at dalvik.system.NativeStart.main(Native Method)
05-01 19:39:16.334 2162-2162/? W/System.err﹕ Caused by: java.lang.NullPointerException
05-01 19:39:16.334 2162-2162/? W/System.err﹕ at freshfrog.pytomat.Main.onCreate(Main.java:450)
05-01 19:39:16.334 2162-2162/? W/System.err﹕ at android.app.Activity.performCreate(Activity.java:5264)
05-01 19:39:16.334 2162-2162/? W/System.err﹕ at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
05-01 19:39:16.334 2162-2162/? W/System.err﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302)
05-01 19:39:16.335 2162-2162/? W/System.err﹕ ... 11 more
05-01 19:39:16.335 2162-2162/? W/dalvikvm﹕ threadid=1: calling UncaughtExceptionHandler
05-01 19:39:16.336 124-124/? I/SurfaceFlinger﹕ Skip composition for [Built-in Screen (type:0)] since dirtyRegion is empty
05-01 19:39:16.339 2162-2162/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: freshfrog.pytomat, PID: 2162
java.lang.RuntimeException: Unable to start activity ComponentInfo{freshfrog.pytomat/freshfrog.pytomat.Main}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2338)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5292)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at freshfrog.pytomat.Main.onCreate(Main.java:450)
at android.app.Activity.performCreate(Activity.java:5264)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
            at android.app.ActivityThread.access$800(ActivityThread.java:151)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
            at android.os.Handler.dispatchMessage(Handler.java:110)
            at android.os.Looper.loop(Looper.java:193)
            at android.app.ActivityThread.main(ActivityThread.java:5292)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
            at dalvik.system.NativeStart.main(Native Method)
05-01 19:39:16.341 654-669/? V/Provider/Settings﹕ from settings cache , name = dropbox:data_app_crash , value = null
05-01 19:39:16.342 654-669/? D/dalvikvm﹕ create interp thread : stack size=128KB
05-01 19:39:16.342 654-669/? D/dalvikvm﹕ create new thread
05-01 19:39:16.343 654-669/? D/dalvikvm﹕ new thread created
05-01 19:39:16.343 654-669/? D/dalvikvm﹕ update thread list
05-01 19:39:16.343 916-2188/? D/dalvikvm﹕ create interp thread : stack size=128KB
05-01 19:39:16.343 916-2188/? D/dalvikvm﹕ create new thread
05-01 19:39:16.343 916-2188/? D/dalvikvm﹕ new thread created
05-01 19:39:16.343 916-2188/? D/dalvikvm﹕ update thread list
05-01 19:39:16.343 654-2191/? D/dalvikvm﹕ threadid=82: interp stack at 0x64403000
05-01 19:39:16.343 654-2191/? D/dalvikvm﹕ threadid=82: created from interp
05-01 19:39:16.343 654-669/? D/dalvikvm﹕ start new thread
05-01 19:39:16.343 654-669/? V/Provider/Settings﹕ from settings cache , name = send_action_app_error , value = 1
05-01 19:39:16.343 654-669/? W/ActivityManager﹕ Force finishing activity freshfrog.pytomat/.Main
Logcat indicate this line (Main.java:450)
mAdView.setAdListener(new AdListener() {
what is this ?
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
what were you expecting? to hit both sides?
try this
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
and let the rest go
You are getting a NullPointerException on line 450 of Main.
Look at that line. Something there has not been initialised.
I solve my problem. This issue isn't connect with AdView. It was problem with project. I made small mistakes. I don't have this line
<?xml version="1.0" encoding="utf-8"?>
on the start of xml layout file. I don't know how it can event works.
I reboot device
I added missing line to xml
I clean project (Build > Clean Project)
I rebuild project (Build > Rebuild Project)
Then my apk starts work without progourd but crash when I enable this feature. So i find this solution
I configure progourd configuration file like this.

Android, class not found from imported jar file

I included a jar file in my Android project as explained in How can I use external JARs in an Android project?. With both methods described by MannyNS and Vinayak B. in this post I get the error "Could not find class 'test.libraryCalc.Calc" which is the class provided by the library. The following code illustrates the problem:
Example class provided via library: Calc.java
package test.libraryCalc;
public class Calc {
public int add(int a, int b){
return a + b;
}
}
LibraryTestActivity.java
package test.library;
import test.libraryCalc.Calc;
import android.app.Activity;
import android.os.Bundle;
public class LibraryTestActivity extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Calc calc = new Calc();
int c = calc.add(3, 4);
}
}
I exported the jar file containing Calc.java to LibraryTest\libs\calc.jar
and added a reference to it using the "Add JARs..." button in the Java Build Path of LibraryTest
The library shows up in the Referenced libraries in LibraryTest
LibraryTest has no build problems but when running it on the emulator the following is shown in LogCat:
12-27 14:01:33.965: E/dalvikvm(747): Could not find class 'test.libraryCalc.Calc', referenced from method test.library.LibraryTestActivity.onCreate
12-27 14:01:33.965: W/dalvikvm(747): VFY: unable to resolve new-instance 13 (Ltest/libraryCalc/Calc;) in Ltest/library/LibraryTestActivity;
12-27 14:01:33.995: D/dalvikvm(747): VFY: replacing opcode 0x22 at 0x0008
12-27 14:01:33.995: D/dalvikvm(747): VFY: dead code 0x000a-0013 in Ltest/library/LibraryTestActivity;.onCreate (Landroid/os/Bundle;)V
12-27 14:01:34.065: D/AndroidRuntime(747): Shutting down VM
12-27 14:01:34.065: W/dalvikvm(747): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
12-27 14:01:34.075: E/AndroidRuntime(747): FATAL EXCEPTION: main
12-27 14:01:34.075: E/AndroidRuntime(747): java.lang.NoClassDefFoundError: test.libraryCalc.Calc
12-27 14:01:34.075: E/AndroidRuntime(747): at test.library.LibraryTestActivity.onCreate(LibraryTestActivity.java:14)
12-27 14:01:34.075: E/AndroidRuntime(747): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-27 14:01:34.075: E/AndroidRuntime(747): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
12-27 14:01:34.075: E/AndroidRuntime(747): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-27 14:01:34.075: E/AndroidRuntime(747): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-27 14:01:34.075: E/AndroidRuntime(747): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-27 14:01:34.075: E/AndroidRuntime(747): at android.os.Handler.dispatchMessage(Handler.java:99)
12-27 14:01:34.075: E/AndroidRuntime(747): at android.os.Looper.loop(Looper.java:123)
12-27 14:01:34.075: E/AndroidRuntime(747): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-27 14:01:34.075: E/AndroidRuntime(747): at java.lang.reflect.Method.invokeNative(Native Method)
12-27 14:01:34.075: E/AndroidRuntime(747): at java.lang.reflect.Method.invoke(Method.java:521)
12-27 14:01:34.075: E/AndroidRuntime(747): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-27 14:01:34.075: E/AndroidRuntime(747): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-27 14:01:34.075: E/AndroidRuntime(747): at dalvik.system.NativeStart.main(Native Method)
12-27 14:06:34.170: I/Process(747): Sending signal. PID: 747 SIG: 9
What needs to be done to get this working? Thanks for all suggestions.
I think that the problem is that you try to add jar that contains Android code. You cannot do this. To include Android code you should create Android library. Simply create an Android project and in the project-properties Android section set that this is library project. After that you'll be able to add this library to your projects. For more about Android libraries you can read here.
Update: I've tried your code now. It works in my case. The only difference that I've made is during export of Jar I've checked Export Java source files and resources. Hope this will help you. Try it!

Android System.err out of the blue

While running my app, LogCat suddenly shows this barrage of orange-colored messages (warnings) which seem to be totally unrelated to my app (and certainly not having the same pid):
05-01 12:00:03.732: WARN/System.err(1836): java.io.FileNotFoundException: http://gh-pages.clockworkmod.com/ROMManagerManifest/premium_imei.js
05-01 12:00:03.752: WARN/System.err(1836): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:1162)
05-01 12:00:03.752: WARN/System.err(1836): at java.net.URL.openStream(URL.java:653)
05-01 12:00:03.752: WARN/System.err(1836): at com.koushikdutta.rommanager.StreamUtility.downloadUrl(StreamUtility.java:46)
05-01 12:00:03.752: WARN/System.err(1836): at com.koushikdutta.rommanager.Helper$1.run(Helper.java:164)
05-01 12:00:03.752: WARN/System.err(1836): at com.koushikdutta.rommanager.Helper.isPremium(Helper.java:178)
05-01 12:00:03.752: WARN/System.err(1836): at com.koushikdutta.rommanager.DownloadService.checkForUpdates(DownloadService.java:314)
05-01 12:00:03.762: WARN/System.err(1836): at com.koushikdutta.rommanager.DownloadService.onStart(DownloadService.java:401)
05-01 12:00:03.762: WARN/System.err(1836): at android.app.Service.onStartCommand(Service.java:420)
05-01 12:00:03.762: WARN/System.err(1836): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3053)
05-01 12:00:03.762: WARN/System.err(1836): at android.app.ActivityThread.access$3600(ActivityThread.java:125)
05-01 12:00:03.762: WARN/System.err(1836): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2096)
05-01 12:00:03.762: WARN/System.err(1836): at android.os.Handler.dispatchMessage(Handler.java:99)
05-01 12:00:03.762: WARN/System.err(1836): at android.os.Looper.loop(Looper.java:123)
05-01 12:00:03.762: WARN/System.err(1836): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-01 12:00:03.762: WARN/System.err(1836): at java.lang.reflect.Method.invokeNative(Native Method)
05-01 12:00:03.762: WARN/System.err(1836): at java.lang.reflect.Method.invoke(Method.java:521)
05-01 12:00:03.762: WARN/System.err(1836): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-01 12:00:03.762: WARN/System.err(1836): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-01 12:00:03.762: WARN/System.err(1836): at dalvik.system.NativeStart.main(Native Method)
05-01 12:00:14.202: WARN/System.err(1836): java.lang.NullPointerException
05-01 12:00:14.202: WARN/System.err(1836): at com.paypal.android.a.h.a(Unknown Source)
05-01 12:00:14.202: WARN/System.err(1836): at com.paypal.android.a.a.j(Unknown Source)
05-01 12:00:14.202: WARN/System.err(1836): at com.paypal.android.a.f.run(Unknown Source)
What does this mean? Is this is a bug in Android? A bug in some other external app or service running in the background?
How do I tell whether this has anything to do with my app-in-development?
(Note: My app doesn't use PayPal or ROM Manager in any way)
There's some kind of error occurring in what the ROM Manager is trying to do - probably a periodic check for new releases.
I wouldn't expect this has anything to do with your application, unless you see it happen during your application multiple times. And even then, I'd leave a logcat open when your app is not running and see if it's happening frequently.
You might want to think if you want to leave that rom manager installed/enabled...
If you aren't using them then it's just those services running in the background. Nothing you have to worry about.
Maybe you should filter to 'Show only selected application'?
That way you'll see only stuff related to your app.

Categories

Resources