I'm using both ActionBarSherlock and HoloEverywhere as libraries in my project, and suddenly HoloEverywhere started messing up.
I made an AlertDialog like this:
AlertDialog.Builder alert = new AlertDialog.Builder(DomaCareDetailViewActivity.this)
.setTitle(R.string.edit_service)
.setItems(R.array.edit_service_array, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//tested and working code
});
alert.create();
alert.show();
But the "create" line throws the exception:
03-21 17:05:35.167: E/AndroidRuntime(25499): FATAL EXCEPTION: main
03-21 17:05:35.167: E/AndroidRuntime(25499): android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
03-21 17:05:35.167: E/AndroidRuntime(25499): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
03-21 17:05:35.167: E/AndroidRuntime(25499): at org.holoeverywhere.LayoutInflater.tryCreateView(LayoutInflater.java:359)
03-21 17:05:35.167: E/AndroidRuntime(25499): at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:308)
03-21 17:05:35.167: E/AndroidRuntime(25499): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
03-21 17:05:35.167: E/AndroidRuntime(25499): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
03-21 17:05:35.167: E/AndroidRuntime(25499): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
03-21 17:05:35.167: E/AndroidRuntime(25499): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:287)
03-21 17:05:35.167: E/AndroidRuntime(25499): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-21 17:05:35.167: E/AndroidRuntime(25499): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:272)
03-21 17:05:35.167: E/AndroidRuntime(25499): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:267)
03-21 17:05:35.167: E/AndroidRuntime(25499): at org.holoeverywhere.internal.AlertController$AlertParams.createListView(AlertController.java:143)
03-21 17:05:35.167: E/AndroidRuntime(25499): at org.holoeverywhere.internal.AlertController$AlertParams.apply(AlertController.java:129)
03-21 17:05:35.167: E/AndroidRuntime(25499): at org.holoeverywhere.app.AlertDialog$Builder.create(AlertDialog.java:60)
03-21 17:05:35.167: E/AndroidRuntime(25499): at com.invian.domacare.task.DomaCareDetailViewActivity$20.onClick(DomaCareDetailViewActivity.java:1004)
03-21 17:05:35.167: E/AndroidRuntime(25499): at android.view.View.performClick(View.java:4084)
03-21 17:05:35.167: E/AndroidRuntime(25499): at android.view.View$PerformClick.run(View.java:16966)
03-21 17:05:35.167: E/AndroidRuntime(25499): at android.os.Handler.handleCallback(Handler.java:615)
03-21 17:05:35.167: E/AndroidRuntime(25499): at android.os.Handler.dispatchMessage(Handler.java:92)
03-21 17:05:35.167: E/AndroidRuntime(25499): at android.os.Looper.loop(Looper.java:137)
03-21 17:05:35.167: E/AndroidRuntime(25499): at android.app.ActivityThread.main(ActivityThread.java:4931)
03-21 17:05:35.167: E/AndroidRuntime(25499): at java.lang.reflect.Method.invokeNative(Native Method)
03-21 17:05:35.167: E/AndroidRuntime(25499): at java.lang.reflect.Method.invoke(Method.java:511)
03-21 17:05:35.167: E/AndroidRuntime(25499): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
03-21 17:05:35.167: E/AndroidRuntime(25499): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
03-21 17:05:35.167: E/AndroidRuntime(25499): at dalvik.system.NativeStart.main(Native Method)
03-21 17:05:35.167: E/AndroidRuntime(25499): Caused by: java.lang.reflect.InvocationTargetException
03-21 17:05:35.167: E/AndroidRuntime(25499): at java.lang.reflect.Constructor.constructNative(Native Method)
03-21 17:05:35.167: E/AndroidRuntime(25499): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-21 17:05:35.167: E/AndroidRuntime(25499): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
03-21 17:05:35.167: E/AndroidRuntime(25499): ... 24 more
03-21 17:05:35.167: E/AndroidRuntime(25499): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f01007a a=-1}
03-21 17:05:35.167: E/AndroidRuntime(25499): at android.content.res.Resources.loadDrawable(Resources.java:1921)
03-21 17:05:35.167: E/AndroidRuntime(25499): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
03-21 17:05:35.167: E/AndroidRuntime(25499): at android.widget.ListView.<init>(ListView.java:153)
03-21 17:05:35.167: E/AndroidRuntime(25499): at org.holoeverywhere.widget.ListView.<init>(ListView.java:205)
03-21 17:05:35.167: E/AndroidRuntime(25499): at org.holoeverywhere.widget.ListView.<init>(ListView.java:200)
03-21 17:05:35.167: E/AndroidRuntime(25499): ... 27 more
I located the source in HoloEverywhere's com.holoeverywhere.internal.AlertController, and something is wrong with line 143:
final ListView listView = (ListView) mInflater
.inflate(dialog.mListLayout, null);
Checking mListLayout's initializing brings me to line 383:
mListLayout = a.getResourceId(R.styleable.AlertDialog_listLayout,
R.layout.select_dialog_holo);
This is as far as I get. I can't find "R.styleable.AlertDialog", but since the AlertDialog.create() throws the exception in my project, I'm sure this is where the problem lies. The select_dialog_holo.xml file does, however, have an error of sorts of its own:
Missing styles. Is the correct theme chosen for this layout?
Use the Theme combo box above the layout to choose a different layout, or fix the theme style references.
Failed to convert ?listDividerAlertDialog into a drawable
Couldn't find theme resource listDividerAlertDialog for the current theme
Anyone have any ideas on how to fix this?
Edit: Going through the HoloEverywhere layout folder, I notice that there are tons of these types of errors. For example, simple_list_item_1 gives me several "could not find resource" errors as well as a few "listPreferredPaddingLeft/Right/etc in attribute paddingLeft is not a valid format" errors.
Related
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'm creating an application which translate user's texts.
First, my code was :
textToReadEdittext.setText(TranslateManager.translate(text, from, to));
Now I need to use the translated text for an other thing. So I use a String variable :
String translatedText = TranslateManager.translate(text, from, to);
textToReadEdittext.setText(translatedText);
But now my application crashes! There is the logs from Eclipse :
03-21 20:24:58.437: E/AndroidRuntime(14867): FATAL EXCEPTION: main
03-21 20:24:58.437: E/AndroidRuntime(14867): java.lang.IllegalStateException: Could not execute method of the activity
03-21 20:24:58.437: E/AndroidRuntime(14867): at android.view.View$1.onClick(View.java:2072)
03-21 20:24:58.437: E/AndroidRuntime(14867): at android.view.View.performClick(View.java:2408)
03-21 20:24:58.437: E/AndroidRuntime(14867): at android.view.View$PerformClick.run(View.java:8817)
03-21 20:24:58.437: E/AndroidRuntime(14867): at android.os.Handler.handleCallback(Handler.java:587)
03-21 20:24:58.437: E/AndroidRuntime(14867): at android.os.Handler.dispatchMessage(Handler.java:92)
03-21 20:24:58.437: E/AndroidRuntime(14867): at android.os.Looper.loop(Looper.java:144)
03-21 20:24:58.437: E/AndroidRuntime(14867): at android.app.ActivityThread.main(ActivityThread.java:4937)
03-21 20:24:58.437: E/AndroidRuntime(14867): at java.lang.reflect.Method.invokeNative(Native Method)
03-21 20:24:58.437: E/AndroidRuntime(14867): at java.lang.reflect.Method.invoke(Method.java:521)
03-21 20:24:58.437: E/AndroidRuntime(14867): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-21 20:24:58.437: E/AndroidRuntime(14867): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-21 20:24:58.437: E/AndroidRuntime(14867): at dalvik.system.NativeStart.main(Native Method)
03-21 20:24:58.437: E/AndroidRuntime(14867): Caused by: java.lang.reflect.InvocationTargetException
03-21 20:24:58.437: E/AndroidRuntime(14867): at fr.robinkaminski.devAndroid.projetthalie.activities.KeyboardActivity.keyboardTranslateListener(KeyboardActivity.java:44)
03-21 20:24:58.437: E/AndroidRuntime(14867): at java.lang.reflect.Method.invokeNative(Native Method)
03-21 20:24:58.437: E/AndroidRuntime(14867): at java.lang.reflect.Method.invoke(Method.java:521)
03-21 20:24:58.437: E/AndroidRuntime(14867): at android.view.View$1.onClick(View.java:2067)
03-21 20:24:58.437: E/AndroidRuntime(14867): ... 11 more
03-21 20:24:58.437: E/AndroidRuntime(14867): Caused by: java.lang.NullPointerException
03-21 20:24:58.437: E/AndroidRuntime(14867): at fr.robinkaminski.devAndroid.projetthalie.translate.TranslateManager.translate(TranslateMana ger.java:74)
03-21 20:24:58.437: E/AndroidRuntime(14867): ... 15 more
I don't understand why my activity crashes. Can you help me?
Thx, korax.
Either your text or from or to is null. Check them before passing to TranslateManager and print it out if any of them are null.
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 getting a very annoying ClassNotFound exception when trying to implement an admob banner in my android app, using admob sdk 4.3.1. I have used the following implementation:
Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxx"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10"
/>
....
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
main.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="#+id/bigmainlayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#color/grey">
<com.google.ads.AdView android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="xxxx"
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR"
ads:loadAdOnCreate="true"/>
</LinearLayout>
Project.properties
target=android-14
Error:
03-21 22:00:25.993: E/AndroidRuntime(333): FATAL EXCEPTION: main 03-21
22:00:25.993: E/AndroidRuntime(333): java.lang.RuntimeException:
Unable to start activity
ComponentInfo{com.xxxx/com.xxxx.MainActivity}:
android.view.InflateException: Binary XML file line #125: Error
inflating class com.google.ads.AdView 03-21 22:00:25.993:
E/AndroidRuntime(333): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
03-21 22:00:25.993: E/AndroidRuntime(333): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
03-21 22:00:25.993: E/AndroidRuntime(333): at
android.app.ActivityThread.access$1500(ActivityThread.java:117) 03-21
22:00:25.993: E/AndroidRuntime(333): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
03-21 22:00:25.993: E/AndroidRuntime(333): at
android.os.Handler.dispatchMessage(Handler.java:99) 03-21
22:00:25.993: E/AndroidRuntime(333): at
android.os.Looper.loop(Looper.java:123) 03-21 22:00:25.993:
E/AndroidRuntime(333): at
android.app.ActivityThread.main(ActivityThread.java:3683) 03-21
22:00:25.993: E/AndroidRuntime(333): at
java.lang.reflect.Method.invokeNative(Native Method) 03-21
22:00:25.993: E/AndroidRuntime(333): at
java.lang.reflect.Method.invoke(Method.java:507) 03-21 22:00:25.993:
E/AndroidRuntime(333): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-21 22:00:25.993: E/AndroidRuntime(333): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 03-21
22:00:25.993: E/AndroidRuntime(333): at
dalvik.system.NativeStart.main(Native Method) 03-21 22:00:25.993:
E/AndroidRuntime(333): Caused by: android.view.InflateException:
Binary XML file line #125: Error inflating class com.google.ads.AdView
03-21 22:00:25.993: E/AndroidRuntime(333): at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
03-21 22:00:25.993: E/AndroidRuntime(333): at
android.view.LayoutInflater.rInflate(LayoutInflater.java:623) 03-21
22:00:25.993: E/AndroidRuntime(333): at
android.view.LayoutInflater.rInflate(LayoutInflater.java:626) 03-21
22:00:25.993: E/AndroidRuntime(333): at
android.view.LayoutInflater.inflate(LayoutInflater.java:408) 03-21
22:00:25.993: E/AndroidRuntime(333): at
android.view.LayoutInflater.inflate(LayoutInflater.java:320) 03-21
22:00:25.993: E/AndroidRuntime(333): at
android.view.LayoutInflater.inflate(LayoutInflater.java:276) 03-21
22:00:25.993: E/AndroidRuntime(333): at
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
03-21 22:00:25.993: E/AndroidRuntime(333): at
android.app.Activity.setContentView(Activity.java:1657) 03-21
22:00:25.993: E/AndroidRuntime(333): at
com.xxxx.MainActivity.onCreate(FreeMedsActivity.java:55) 03-21
22:00:25.993: E/AndroidRuntime(333): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-21 22:00:25.993: E/AndroidRuntime(333): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
03-21 22:00:25.993: E/AndroidRuntime(333): ... 11 more 03-21
22:00:25.993: E/AndroidRuntime(333): Caused by:
java.lang.ClassNotFoundException: com.google.ads.AdView in loader
dalvik.system.PathClassLoader[/data/app/com.xxxx-2.apk] 03-21
22:00:25.993: E/AndroidRuntime(333): at
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
03-21 22:00:25.993: E/AndroidRuntime(333): at
java.lang.ClassLoader.loadClass(ClassLoader.java:551) 03-21
22:00:25.993: E/AndroidRuntime(333): at
java.lang.ClassLoader.loadClass(ClassLoader.java:511) 03-21
22:00:25.993: E/AndroidRuntime(333): at
android.view.LayoutInflater.createView(LayoutInflater.java:471) 03-21
22:00:25.993: E/AndroidRuntime(333): at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570
)
I get a similar classnotfound exception when creating the adview in code and adding it to the layout. I get this error on OS 2.2, 2.3.3, 2.3.7, and 4.0. I have added the admobsdk.jar to the build path. I have tried switching the minSSdkVersion to 14. I am using eclipse indigo.
I am wondering if this has to do with how I am adding the .jar. I have it copied into a /lib folder in the project, and then either do add to build path or preferences-->build path-->add JAR. I am wondering if somehow the app doesn't know where to find the .jar still...
Turns out r17 of Android Tools requires the /lib folder to be /libs, and the SDK has to be placed in there and referenced internally in order for it to be included in the apk.
Check out this link for more information.
I have same problem
I was fix it in Eclipse by
Project -> Clean
Project -> propertise -> Java build path -> Order and Export (Check googleAdmod jar)
Hope this help!
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