I use this quick start example https://developers.google.com/drive/quickstart-android
Logcat shows
03-21 14:44:36.213: E/AndroidRuntime(26394): FATAL EXCEPTION: Thread-1867
03-21 14:44:36.213: E/AndroidRuntime(26394): java.lang.NullPointerException
03-21 14:44:36.213: E/AndroidRuntime(26394): at java.net.URI.parseURI(URI.java:353)
03-21 14:44:36.213: E/AndroidRuntime(26394): at java.net.URI.<init>(URI.java:204)
03-21 14:44:36.213: E/AndroidRuntime(26394): at com.google.api.client.http.GenericUrl.<init>(GenericUrl.java:100)
03-21 14:44:36.213: E/AndroidRuntime(26394): at com.google.api.client.googleapis.media.MediaHttpUploader.upload(MediaHttpUploader.java:269)
03-21 14:44:36.213: E/AndroidRuntime(26394): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:408)
03-21 14:44:36.213: E/AndroidRuntime(26394): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:328)
03-21 14:44:36.213: E/AndroidRuntime(26394): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:449)
03-21 14:44:36.213: E/AndroidRuntime(26394): at com.mysample.google.GoogleDrive$1.run(GoogleDrive.java:161)
03-21 14:44:36.213: E/AndroidRuntime(26394): at java.lang.Thread.run(Thread.java:856)
GoogleDrive.java:161 is
File file = service.files().insert(body, mediaContent).execute();
I already turn on Drive API and Drive SDK at Google APIs console.
I also added these lines at AndroidManifest.xml
<meta-data android:name="com.google.android.apps.drive.APP_ID" android:value="id=MY_APP_ID" />
<intent-filter>
<action android:name="android.intent.action.GoogleDrive" />
<data android:mimeType="image/png" />
<data android:mimeType="image/jpeg" />
<data android:mimeType="image/jpg" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Thanks for any helping.
Related
I'm trying using intent to add class to an application. I have made SecondAcitivity class and modified the manifest file as well. My application is running i.e. First activity Containing the button works well, but onclick on button the error comes and it does not displays a second activity.
This is my MainActivity.java file
package com.intent.usingintent;
import android.os.Bundle;
import android.content.Intent;
import android.app.Activity;
import android.view.View;
public class MainActivity extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void onClick(View view){
startActivity(new Intent("com.intent.SecondActivity"));
}
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.intent.usingintent"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.intent.usingintent.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.intent.SecondActivity"
android:label="SecondActivity" >
</activity>
<intent-filter>
<action android:name=".SecondActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</application>
</manifest>
ERROR LOG
07-09 13:57:45.922: W/dalvikvm(20185): threadid=1: thread exiting with uncaught exception (group=0x40d8e2a0)
07-09 13:57:45.932: E/AndroidRuntime(20185): FATAL EXCEPTION: main
07-09 13:57:45.932: E/AndroidRuntime(20185): java.lang.IllegalStateException: Could not execute method of the activity
07-09 13:57:45.932: E/AndroidRuntime(20185): at android.view.View$1.onClick(View.java:3699)
07-09 13:57:45.932: E/AndroidRuntime(20185): at android.view.View.performClick(View.java:4223)
07-09 13:57:45.932: E/AndroidRuntime(20185): at android.view.View$PerformClick.run(View.java:17275)
07-09 13:57:45.932: E/AndroidRuntime(20185): at android.os.Handler.handleCallback(Handler.java:615)
07-09 13:57:45.932: E/AndroidRuntime(20185): at android.os.Handler.dispatchMessage(Handler.java:92)
07-09 13:57:45.932: E/AndroidRuntime(20185): at android.os.Looper.loop(Looper.java:137)
07-09 13:57:45.932: E/AndroidRuntime(20185): at android.app.ActivityThread.main(ActivityThread.java:4898)
07-09 13:57:45.932: E/AndroidRuntime(20185): at java.lang.reflect.Method.invokeNative(Native Method)
07-09 13:57:45.932: E/AndroidRuntime(20185): at java.lang.reflect.Method.invoke(Method.java:511)
07-09 13:57:45.932: E/AndroidRuntime(20185): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
07-09 13:57:45.932: E/AndroidRuntime(20185): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
07-09 13:57:45.932: E/AndroidRuntime(20185): at dalvik.system.NativeStart.main(Native Method)
07-09 13:57:45.932: E/AndroidRuntime(20185): Caused by: java.lang.reflect.InvocationTargetException
07-09 13:57:45.932: E/AndroidRuntime(20185): at java.lang.reflect.Method.invokeNative(Native Method)
07-09 13:57:45.932: E/AndroidRuntime(20185): at java.lang.reflect.Method.invoke(Method.java:511)
07-09 13:57:45.932: E/AndroidRuntime(20185): at android.view.View$1.onClick(View.java:3694)
07-09 13:57:45.932: E/AndroidRuntime(20185): ... 11 more
07-09 13:57:45.932: E/AndroidRuntime(20185): Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.intent.SecondActivity }
07-09 13:57:45.932: E/AndroidRuntime(20185): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1580)
07-09 13:57:45.932: E/AndroidRuntime(20185): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1431)
07-09 13:57:45.932: E/AndroidRuntime(20185): at android.app.Activity.startActivityForResult(Activity.java:3446)
07-09 13:57:45.932: E/AndroidRuntime(20185): at android.app.Activity.startActivityForResult(Activity.java:3407)
07-09 13:57:45.932: E/AndroidRuntime(20185): at android.app.Activity.startActivity(Activity.java:3617)
07-09 13:57:45.932: E/AndroidRuntime(20185): at android.app.Activity.startActivity(Activity.java:3585)
07-09 13:57:45.932: E/AndroidRuntime(20185): at com.intent.usingintent.MainActivity.onClick(MainActivity.java:17)
07-09 13:57:45.932: E/AndroidRuntime(20185): ... 14 more
07-09 13:57:57.072: I/Process(20185): Sending signal. PID: 20185 SIG: 9
In your App, your second activity in com.intent.usingintent package.And your intent action is com.intent.SecondActivity,and write <intent-filter> inside <activity> tag.
So in manifest file,Change
<activity
android:name="com.intent.SecondActivity"
android:label="SecondActivity" >
</activity>
<intent-filter>
<action android:name=".SecondActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
to
<activity
android:name="com.intent.usingintent.SecondActivity"
android:label="SecondActivity" >
<intent-filter>
<action android:name="com.intent.SecondActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
You have misplaced IntentFilter for the SecondActivity in the manifest. Put it insude <activity></activity>
Though you do no treally need that you can simply do startActivity(new Intent(this, SecondActivity.class));
in your manifest file instead of this
<activity
android:name="com.intent.SecondActivity"
android:label="SecondActivity" >
</activity>
replace with
<activity
android:name="com.intent.usingintent.SecondActivity"
android:label="SecondActivity" >
</activity>
and even in your java class also
startActivity(new Intent("com.intent.SecondActivity"));
replace this with
startActivity(new Intent("com.intent.usingintent.SecondActivity"));
change in manifest file
<activity
android:name="com.intent.usingintent.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="SecondActivity"></activity>
change in click event
Intent n=new Intent(MainActivity.this,SecondActivity.class);
startActivity(n);
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have designed Main class. From main I am calling another class named Menu that extends Activity, and from Menu class I am calling another activity class. But it's not working. What changes should be needed in manifest file?
Here the logcat
09-09 23:53:42.741: D/gralloc_goldfish(2105): Emulator without GPU emulation detected.
09-09 23:53:47.982: D/AndroidRuntime(2105): Shutting down VM
09-09 23:53:47.982: W/dalvikvm(2105): threadid=1: thread exiting with uncaught exception (group=0xb4e02288)
09-09 23:53:48.011: E/AndroidRuntime(2105): FATAL EXCEPTION: main
09-09 23:53:48.011: E/AndroidRuntime(2105): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.parse.starter/com.parse.starter.Placementmania}; have you declared this activity in your AndroidManifest.xml?
09-09 23:53:48.011: E/AndroidRuntime(2105): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1541)
09-09 23:53:48.011: E/AndroidRuntime(2105): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1416)
09-09 23:53:48.011: E/AndroidRuntime(2105): at android.app.Activity.startActivityForResult(Activity.java:3351)
09-09 23:53:48.011: E/AndroidRuntime(2105): at android.app.Activity.startActivityForResult(Activity.java:3312)
09-09 23:53:48.011: E/AndroidRuntime(2105): at android.app.Activity.startActivity(Activity.java:3522)
09-09 23:53:48.011: E/AndroidRuntime(2105): at android.app.Activity.startActivity(Activity.java:3490)
09-09 23:53:48.011: E/AndroidRuntime(2105): at com.parse.starter.Mainmenu$1.onClick(Mainmenu.java:27)
09-09 23:53:48.011: E/AndroidRuntime(2105): at android.view.View.performClick(View.java:4084)
09-09 23:53:48.011: E/AndroidRuntime(2105): at android.view.View$PerformClick.run(View.java:16966)
09-09 23:53:48.011: E/AndroidRuntime(2105): at android.os.Handler.handleCallback(Handler.java:615)
09-09 23:53:48.011: E/AndroidRuntime(2105): at android.os.Handler.dispatchMessage(Handler.java:92)
09-09 23:53:48.011: E/AndroidRuntime(2105): at android.os.Looper.loop(Looper.java:137)
09-09 23:53:48.011: E/AndroidRuntime(2105): at android.app.ActivityThread.main(ActivityThread.java:4745)
09-09 23:53:48.011: E/AndroidRuntime(2105): at java.lang.reflect.Method.invokeNative(Native Method)
09-09 23:53:48.011: E/AndroidRuntime(2105): at java.lang.reflect.Method.invoke(Method.java:511)
09-09 23:53:48.011: E/AndroidRuntime(2105): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-09 23:53:48.011: E/AndroidRuntime(2105): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-09 23:53:48.011: E/AndroidRuntime(2105): at dalvik.system.NativeStart.main(Native Method)
09-09 23:53:50.212: I/Process(2105): Sending signal. PID: 2105 SIG: 9
In your manifest, you'll see this code
<activity
android:name="com.example.yourappname.MainScreen"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Basically copy and paste that and modify pasted one with the name and category for each of your classes like this:
<activity
android:name="com.example.audeoapp.OtherClass" >
<intent-filter>
<action android:name="android.intent.action.OTHERCLASS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.example.audeoapp.AnotherClass" >
<intent-filter>
<action android:name="android.intent.action.ANOTHERCLASS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Add this into your manifest
<activity
android:name="com.parse.starter.Placementmania"
android:label="#string/app_name"
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
intent.action.main and intent.category.launcher tells that this activity is your main and launching activity which should get open when you launch your app..for other activities just put you activity name and label inside the new activity tag.
Hello i will be needing help with my Android app to insert google maps into the app, but every time i do that the app chrashes, and i'm going to insert my code below if there is somebody that can help my to find the problem with the code.
Androidmanifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.maret.maps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="17" />
<permission
android:name="com.maret.toilet.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<uses-permission android:name="com.maret.toilet.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.maret.toilet.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>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="***MY_API_KEY****"/>
</application>
</manifest>
Here is my activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="My Location"
android:onClick="getLocation"
android:layout_weight="0"
/>
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment"/>
</LinearLayout>
Here is my MainActivity.java
package com.maret.maps;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
MY ERROR LOG
03-19 08:41:45.552: E/Trace(641): error opening trace file:
No such file or directory (2)
03-19 08:41:45.861: D/AndroidRuntime(641):
Shutting down VM
03-19 08:41:45.872: W/dalvikvm(641):
threadid=1: thread exiting with uncaught exception (group=0x40a13300)
03-19 08:41:45.891: E/AndroidRuntime(641): FATAL EXCEPTION: main
03-19 08:41:45.891: E/AndroidRuntime(641):
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.maret.toilet/com.maret.toilet.MainActivity}: android.view.InflateException:
Binary XML file line #15: Error inflating class fragment
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.ActivityThread.access$600(ActivityThread.java:130)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.os.Handler.dispatchMessage(Handler.java:99)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.os.Looper.loop(Looper.java:137)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.ActivityThread.main(ActivityThread.java:4745)
03-19 08:41:45.891: E/AndroidRuntime(641):
at java.lang.reflect.Method.invokeNative(Native Method)
03-19 08:41:45.891: E/AndroidRuntime(641):
at java.lang.reflect.Method.invoke(Method.java:511)
03-19 08:41:45.891: E/AndroidRuntime(641):
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
03-19 08:41:45.891: E/AndroidRuntime(641):
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
03-19 08:41:45.891: E/AndroidRuntime(641):
at dalvik.system.NativeStart.main(Native Method)
03-19 08:41:45.891: E/AndroidRuntime(641):
Caused by: android.view.InflateException:
Binary XML file line #15: Error inflating class fragment
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-19 08:41:45.891: E/AndroidRuntime(641):
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Activity.setContentView(Activity.java:1867)
03-19 08:41:45.891: E/AndroidRuntime(641):
at com.maret.toilet.MainActivity.onCreate(MainActivity.java:12)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Activity.performCreate(Activity.java:5008)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
03-19 08:41:45.891: E/AndroidRuntime(641): ... 11 more
03-19 08:41:45.891: E/AndroidRuntime(641):
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
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Fragment.instantiate(Fragment.java:584)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Fragment.instantiate(Fragment.java:552)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Activity.onCreateView(Activity.java:4656)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
03-19 08:41:45.891: E/AndroidRuntime(641): ... 21 more
03-19 08:41:45.891: E/AndroidRuntime(641):
Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.MapFragment
03-19 08:41:45.891: E/AndroidRuntime(641):
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
03-19 08:41:45.891: E/AndroidRuntime(641):
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
03-19 08:41:45.891: E/AndroidRuntime(641):
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Fragment.instantiate(Fragment.java:574)
03-19 08:41:45.891: E/AndroidRuntime(641): ... 24 more
HERE IS THE NEW LAYOUT AND ACTIVITY
THIS IS main.xml
<?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
android:name="com.google.android.gms.maps.SupportMapFragment"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
* HERE IS MY main.java **
package com.maret.maps;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class Main extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.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;
}
}
HERE IS THE NEW LOGCAT WHEN THE APP CHRASHES**
03-21 12:23:03.633: E/Trace(958): error opening trace file: No such file or directory (2)
03-21 12:23:04.422: D/AndroidRuntime(958): Shutting down VM
03-21 12:23:04.432: W/dalvikvm(958): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
03-21 12:23:04.452: E/AndroidRuntime(958): FATAL EXCEPTION: main
03-21 12:23:04.452: E/AndroidRuntime(958): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.maret.maps/com.maret.maps.Main}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.ActivityThread.access$600(ActivityThread.java:130)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.os.Handler.dispatchMessage(Handler.java:99)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.os.Looper.loop(Looper.java:137)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.ActivityThread.main(ActivityThread.java:4745)
03-21 12:23:04.452: E/AndroidRuntime(958): at java.lang.reflect.Method.invokeNative(Native Method)
03-21 12:23:04.452: E/AndroidRuntime(958): at java.lang.reflect.Method.invoke(Method.java:511)
03-21 12:23:04.452: E/AndroidRuntime(958): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
03-21 12:23:04.452: E/AndroidRuntime(958): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
03-21 12:23:04.452: E/AndroidRuntime(958): at dalvik.system.NativeStart.main(Native Method)
03-21 12:23:04.452: E/AndroidRuntime(958): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
03-21 12:23:04.452: E/AndroidRuntime(958): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-21 12:23:04.452: E/AndroidRuntime(958): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.Activity.setContentView(Activity.java:1867)
03-21 12:23:04.452: E/AndroidRuntime(958): at com.maret.maps.Main.onCreate(Main.java:12)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.Activity.performCreate(Activity.java:5008)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
03-21 12:23:04.452: E/AndroidRuntime(958): ... 11 more
03-21 12:23:04.452: E/AndroidRuntime(958): Caused by: java.lang.ClassCastException: com.google.android.gms.maps.SupportMapFragment cannot be cast to android.app.Fragment
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.Fragment.instantiate(Fragment.java:577)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.Fragment.instantiate(Fragment.java:552)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.Activity.onCreateView(Activity.java:4656)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
03-21 12:23:04.452: E/AndroidRuntime(958): ... 21 more
03-21 12:23:07.973: I/Process(958): Sending signal. PID: 958 SIG: 9
Here is blog post I wrote on how to create a Map fragment in your application:
Google Maps API V2
From your code it look like your permission are not defined properly, you need to add this:
<permission android:name="com.maret.maps.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.maret.maps.permission.MAPS_RECEIVE"/>
And please add your logcat stack trace at crash moment so we could understand more clearly what the problem is.
UPDATE:
From the error you are receiving:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.maret.toilet/com.maret.toilet.MainActivity}: android.view.InflateException:
Binary XML file line #15: Error inflating class fragment
it's seems that you are not referencing the google-play-services library as needed, and this is the reason the fragment can't be inflated. the MapFragment class can't be find.
please check the guide that I posted at the beginning of the answer to see how to make the referencing correctly.
Your application tag in your manifest is missing this line
<uses-library android:name="com.google.android.maps" />
Add that and it should fix the crash
EDIT : This will only work for maps api version 1
I am new with PhoneGap and I am using it for android. I am following step-by-step the tutorial HelloPhoneGap from http://phonegap.com/start/#android. at first run it it runs ok, but later-on when I run it i got this error:
logcat:
03-21 09:52:02.467: D/dalvikvm(534): Not late-enabling CheckJNI (already on)
03-21 09:52:04.738: W/System.err(534): =====================================================================================
03-21 09:52:04.738: W/System.err(534): ERROR: plugin.xml is missing. Add res/xml/plugins.xml to your project.
03-21 09:52:04.738: W/System.err(534): https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=blob;f=framework/res/xml/plugins.xml
03-21 09:52:04.738: W/System.err(534): =====================================================================================
03-21 09:52:04.738: W/ResourceType(534): No package identifier when getting value for resource number 0x00000000
03-21 09:52:04.748: D/AndroidRuntime(534): Shutting down VM
03-21 09:52:04.748: W/dalvikvm(534): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
03-21 09:52:04.758: W/System.err(534): java.net.SocketException: socket failed: EACCES (Permission denied)
03-21 09:52:04.768: W/System.err(534): at libcore.io.IoBridge.socket(IoBridge.java:573)
03-21 09:52:04.768: W/System.err(534): at java.net.PlainSocketImpl.create(PlainSocketImpl.java:201)
03-21 09:52:04.768: W/System.err(534): at java.net.PlainServerSocketImpl.create(PlainServerSocketImpl.java:38)
03-21 09:52:04.778: W/System.err(534): at java.net.ServerSocket.<init>(ServerSocket.java:98)
03-21 09:52:04.788: W/System.err(534): at java.net.ServerSocket.<init>(ServerSocket.java:69)
03-21 09:52:04.788: W/System.err(534): at org.apache.cordova.CallbackServer.run(CallbackServer.java:208)
03-21 09:52:04.788: W/System.err(534): at java.lang.Thread.run(Thread.java:856)
03-21 09:52:04.788: W/System.err(534): Caused by: libcore.io.ErrnoException: socket failed: EACCES (Permission denied)
03-21 09:52:04.788: W/System.err(534): at libcore.io.Posix.socket(Native Method)
03-21 09:52:04.788: W/System.err(534): at libcore.io.BlockGuardOs.socket(BlockGuardOs.java:181)
03-21 09:52:04.788: W/System.err(534): at libcore.io.IoBridge.socket(IoBridge.java:558)
03-21 09:52:04.788: W/System.err(534): ... 6 more
03-21 09:52:04.817: E/AndroidRuntime(534): FATAL EXCEPTION: main
03-21 09:52:04.817: E/AndroidRuntime(534): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.phonegap.helloworld/com.phonegap.helloworld.app}: android.content.res.Resources$NotFoundException: Resource ID #0x0
03-21 09:52:04.817: E/AndroidRuntime(534): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.app.ActivityThread.access$600(ActivityThread.java:123)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.os.Handler.dispatchMessage(Handler.java:99)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.os.Looper.loop(Looper.java:137)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.app.ActivityThread.main(ActivityThread.java:4424)
03-21 09:52:04.817: E/AndroidRuntime(534): at java.lang.reflect.Method.invokeNative(Native Method)
03-21 09:52:04.817: E/AndroidRuntime(534): at java.lang.reflect.Method.invoke(Method.java:511)
03-21 09:52:04.817: E/AndroidRuntime(534): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-21 09:52:04.817: E/AndroidRuntime(534): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-21 09:52:04.817: E/AndroidRuntime(534): at dalvik.system.NativeStart.main(Native Method)
03-21 09:52:04.817: E/AndroidRuntime(534): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
03-21 09:52:04.817: E/AndroidRuntime(534): at android.content.res.Resources.getValue(Resources.java:1019)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2107)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.content.res.Resources.getXml(Resources.java:907)
03-21 09:52:04.817: E/AndroidRuntime(534): at org.apache.cordova.api.PluginManager.loadPlugins(PluginManager.java:82)
03-21 09:52:04.817: E/AndroidRuntime(534): at org.apache.cordova.api.PluginManager.<init>(PluginManager.java:62)
03-21 09:52:04.817: E/AndroidRuntime(534): at org.apache.cordova.DroidGap$1.run(DroidGap.java:502)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.app.Activity.runOnUiThread(Activity.java:4170)
03-21 09:52:04.817: E/AndroidRuntime(534): at org.apache.cordova.DroidGap.loadUrlIntoView(DroidGap.java:478)
03-21 09:52:04.817: E/AndroidRuntime(534): at org.apache.cordova.DroidGap.loadUrl(DroidGap.java:444)
03-21 09:52:04.817: E/AndroidRuntime(534): at com.phonegap.helloworld.app.onCreate(app.java:15)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.app.Activity.performCreate(Activity.java:4465)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
03-21 09:52:04.817: E/AndroidRuntime(534): ... 11 more
console:
[2012-03-21 09:49:28 - HelloPhoneGap] ------------------------------
[2012-03-21 09:49:28 - HelloPhoneGap] Android Launch!
[2012-03-21 09:49:28 - HelloPhoneGap] adb is running normally.
[2012-03-21 09:49:28 - HelloPhoneGap] Performing com.phonegap.helloworld.app activity launch
[2012-03-21 09:49:28 - HelloPhoneGap] Automatic Target Mode: launching new emulator with compatible AVD 'avd'
[2012-03-21 09:49:28 - HelloPhoneGap] Launching a new emulator with Virtual Device 'avd'
[2012-03-21 09:49:39 - Emulator] emulator: WARNING: Unable to create sensors port: Connection refused
[2012-03-21 09:49:39 - Emulator] emulator: emulator window was out of view and was recentered
[2012-03-21 09:49:39 - Emulator]
[2012-03-21 09:49:41 - HelloPhoneGap] New emulator found: emulator-5554
[2012-03-21 09:49:41 - HelloPhoneGap] Waiting for HOME ('android.process.acore') to be launched...
[2012-03-21 09:51:23 - HelloPhoneGap] HOME is up on device 'emulator-5554'
[2012-03-21 09:51:23 - HelloPhoneGap] Uploading HelloPhoneGap.apk onto device 'emulator-5554'
[2012-03-21 09:51:24 - HelloPhoneGap] Installing HelloPhoneGap.apk...
[2012-03-21 09:52:02 - HelloPhoneGap] Success!
[2012-03-21 09:52:02 - HelloPhoneGap] Starting activity com.phonegap.helloworld.app on device emulator-5554
[2012-03-21 09:52:04 - HelloPhoneGap] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.phonegap.helloworld/.app }
can anyone can help me about my case?
The fix that worked for me was to copy the file 'config.xml' from the Cordova download zip (lib/android/example/res/xml/config.xml) into my project's res/xml folder. I ran into this same error, working through the Cordova 2.0.0 Getting Started with Android page. The file plugin.xml does not appear to be in Cordova 2.0.0 (at least in the Android branch). The error to logcat still mentions it however.
1) In onCreate method did you initialize like super.init(); if not do
2) check plugins present in this path "xml/res/plugins.xml" if not find plugins here
Note: put that plugins tag inside cordova like <cordova> <plugins> <plugin> </plugins> </cordova>
I am trying to use inMobi(ver 2) through Adwhirl(2.6.3) on my Android(2.2) application.
But I am recieving an odd problem.
Do you have any idea what is wrong?
Here is the stack trace:
03-21 21:33:39.656: VERBOSE/inmobiandroidwebsdk(30457): requestactivity=AdRequest&d-deviceModel=Nexus+One&d-deviceMachineHW=Linux%28Android%3A2.6.35.7-59423-g08607d4%29&d-deviceSystemName=BASE&d-deviceSystemVersion=1.0&d-deviceName=google&d-deviceBTHW=Sat+Mar+19+08%3A15%3A44+GMT%2B02%3A00+2011&d-deviceStorageSize=InBuilt%3A196+MB%2CExt%3A3+GB&d-device-screen-density=1.5&d-device-screen-size=480X800&x-inmobi-phone-useragent=Mozilla%2F5.0+%28Linux%3B+U%3B+Android+2.3.3%3B+en-us%3B+Nexus+One+Build%2FGRI40%29+AppleWebKit%2F533.1+%28KHTML%2C+like+Gecko%29+Version%2F4.0+Mobile+Safari%2F533.1&mk-siteid=ff8080812eb70f85012ecd66bc330119&u-id=173adca6177f8d35&mk-version=pr-SPEC-ATATA-20091223&format=xhtml&mk-ads=1&h-user-agent=InMobi_androidsdk%3D2.0&u-InMobi_androidwebsdkVersion=2.0&u-appBId=com.tests.mytest&u-appDNM=Pattern+Maker&u-appVer=1.1&d-localization=en_us&d-netType=&mk-banner-size=9
03-21 21:33:39.656: WARN/inmobiandroidwebsdk(30457): requestactivity=AdRequest&d-deviceModel=Nexus+One&d-deviceMachineHW=Linux%28Android%3A2.6.35.7-59423-g08607d4%29&d-deviceSystemName=BASE&d-deviceSystemVersion=1.0&d-deviceName=google&d-deviceBTHW=Sat+Mar+19+08%3A15%3A44+GMT%2B02%3A00+2011&d-deviceStorageSize=InBuilt%3A196+MB%2CExt%3A3+GB&d-device-screen-density=1.5&d-device-screen-size=480X800&x-inmobi-phone-useragent=Mozilla%2F5.0+%28Linux%3B+U%3B+Android+2.3.3%3B+en-us%3B+Nexus+One+Build%2FGRI40%29+AppleWebKit%2F533.1+%28KHTML%2C+like+Gecko%29+Version%2F4.0+Mobile+Safari%2F533.1&mk-siteid=ff8080812eb70f85012ecd66bc330119&u-id=173adca6177f8d35&mk-version=pr-SPEC-ATATA-20091223&format=xhtml&mk-ads=1&h-user-agent=InMobi_androidsdk%3D2.0&u-InMobi_androidwebsdkVersion=2.0&u-appBId=com.tests.mytest&u-appDNM=Pattern+Maker&u-appVer=1.1&d-localization=en_us&d-netType=&mk-banner-size=9
03-21 21:33:41.576: ERROR/inmobiandroidwebsdk(30457): Exception retrieving ad
03-21 21:33:41.576: ERROR/inmobiandroidwebsdk(30457): com.inmobi.androidsdk.impl.net.ConnectionException: Error requesting new Ad
03-21 21:33:41.576: ERROR/inmobiandroidwebsdk(30457): at com.inmobi.androidsdk.impl.net.RequestResponseManager.retrieveAd(RequestResponseManager.java:197)
03-21 21:33:41.576: ERROR/inmobiandroidwebsdk(30457): at com.inmobi.androidsdk.impl.net.RequestResponseManager.requestAd(RequestResponseManager.java:54)
03-21 21:33:41.576: ERROR/inmobiandroidwebsdk(30457): at com.inmobi.androidsdk.impl.InMobiAdView.fetchAndDisplayAd(InMobiAdView.java:206)
03-21 21:33:41.576: ERROR/inmobiandroidwebsdk(30457): at com.inmobi.androidsdk.impl.InMobiAdView.access$4(InMobiAdView.java:179)
03-21 21:33:41.576: ERROR/inmobiandroidwebsdk(30457): at com.inmobi.androidsdk.impl.InMobiAdView$3.call(InMobiAdView.java:292)
03-21 21:33:41.576: ERROR/inmobiandroidwebsdk(30457): at com.inmobi.androidsdk.impl.InMobiAdView$3.call(InMobiAdView.java:1)
03-21 21:33:41.576: ERROR/inmobiandroidwebsdk(30457): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
03-21 21:33:41.576: ERROR/inmobiandroidwebsdk(30457): at java.util.concurrent.FutureTask.run(FutureTask.java:138)
03-21 21:33:41.576: ERROR/inmobiandroidwebsdk(30457): at android.os.Handler.handleCallback(Handler.java:587)
03-21 21:33:41.576: ERROR/inmobiandroidwebsdk(30457): at android.os.Handler.dispatchMessage(Handler.java:92)
03-21 21:33:41.576: ERROR/inmobiandroidwebsdk(30457): at android.os.Looper.loop(Looper.java:123)
03-21 21:33:41.576: ERROR/inmobiandroidwebsdk(30457): at com.inmobi.androidsdk.impl.BackgroundWorker$1.run(BackgroundWorker.java:36)
03-21 21:33:41.576: ERROR/inmobiandroidwebsdk(30457): at java.lang.Thread.run(Thread.java:1019)
03-21 21:33:41.576: ERROR/inmobiandroidwebsdk(30457): Caused by: java.io.FileNotFoundException: http://w.sandbox.mkhoj.com/showad.asm
03-21 21:33:41.576: ERROR/inmobiandroidwebsdk(30457): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:521)
03-21 21:33:41.576: ERROR/inmobiandroidwebsdk(30457): at com.inmobi.androidsdk.impl.net.RequestResponseManager.retrieveAd(RequestResponseManager.java:157)
03-21 21:33:41.576: ERROR/inmobiandroidwebsdk(30457): ... 12 more
I'm from the InMobi Operations team. The problem is that the latest Adwhirl release does not have the updated InMobi Adapters. Can you try with the following versions of the Adwhirl Adapter and the InMobi SDK?
Updated InMobi Android SDK: http://dl.dropbox.com/u/16117/InMobi_Android_SDK_Rel_v2.3.zip Update Adwhirl Adapters:
http://dl.dropbox.com/u/30899852/InMobiAdapter.java – This is for the Source version of Adwhirl SDK http://dl.dropbox.com/u/30899852/adWhirl/AdWhirlSDK_Android_3.0.0.jar – This is for developers using the Compiled version of the Adwhirl SDK (has the adapters of other ad networks which come by default with the Source SDK)
Just to make sure, have you requested the Internet permission ?
InMobi adapter that is part of the Adwhirl SDK is not compatible with InMobi SDK version 2.0
Please star the open issues (looks like some are repeated) here:
http://code.google.com/p/adwhirl/issues/detail?id=176
http://code.google.com/p/adwhirl/issues/detail?id=186
http://code.google.com/p/adwhirl/issues/detail?id=187