Unable to use checkbox in eclipse with android adt plugin - android

I'm a newbie android app developer, beginner really. I've tried creating a checkbox on the xml layout on eclipse IDE, for some reason when I run app, it just crashes.
It says resource not found. Following is the logcat:
03-11 20:39:47.167: E/AndroidRuntime(24934): FATAL EXCEPTION: main
03-11 20:39:47.167: E/AndroidRuntime(24934): Process: com.example.checking, PID: 24934
03-11 20:39:47.167: E/AndroidRuntime(24934): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.checking/com.example.checking.MainActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class android.widget.CheckBox
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2200)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2249)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.app.ActivityThread.access$800(ActivityThread.java:141)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.os.Handler.dispatchMessage(Handler.java:102)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.os.Looper.loop(Looper.java:136)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.app.ActivityThread.main(ActivityThread.java:5052)
03-11 20:39:47.167: E/AndroidRuntime(24934): at java.lang.reflect.Method.invokeNative(Native Method)
03-11 20:39:47.167: E/AndroidRuntime(24934): at java.lang.reflect.Method.invoke(Method.java:515)
03-11 20:39:47.167: E/AndroidRuntime(24934): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-11 20:39:47.167: E/AndroidRuntime(24934): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
03-11 20:39:47.167: E/AndroidRuntime(24934): at dalvik.system.NativeStart.main(Native Method)
03-11 20:39:47.167: E/AndroidRuntime(24934): Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class android.widget.CheckBox
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.view.LayoutInflater.createView(LayoutInflater.java:623)
03-11 20:39:47.167: E/AndroidRuntime(24934): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:672)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.view.LayoutInflater.inflate(LayoutInflater.java:400)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
03-11 20:39:47.167: E/AndroidRuntime(24934): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.app.Activity.setContentView(Activity.java:1946)
03-11 20:39:47.167: E/AndroidRuntime(24934): at com.example.checking.MainActivity.onCreate(MainActivity.java:13)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.app.Activity.performCreate(Activity.java:5248)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2164)
03-11 20:39:47.167: E/AndroidRuntime(24934): ... 11 more
03-11 20:39:47.167: E/AndroidRuntime(24934): Caused by: java.lang.reflect.InvocationTargetException
03-11 20:39:47.167: E/AndroidRuntime(24934): at java.lang.reflect.Constructor.constructNative(Native Method)
03-11 20:39:47.167: E/AndroidRuntime(24934): at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.view.LayoutInflater.createView(LayoutInflater.java:597)
03-11 20:39:47.167: E/AndroidRuntime(24934): ... 24 more
03-11 20:39:47.167: E/AndroidRuntime(24934): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/abc_btn_check_material.xml from drawable resource ID #0x7f020003
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.content.res.Resources.loadDrawable(Resources.java:2149)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.content.res.MiuiResources.loadDrawable(MiuiResources.java:387)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.content.res.Resources.loadDrawable(Resources.java:2072)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.widget.CompoundButton.<init>(CompoundButton.java:74)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.widget.CheckBox.<init>(CheckBox.java:68)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.widget.CheckBox.<init>(CheckBox.java:64)
03-11 20:39:47.167: E/AndroidRuntime(24934): ... 27 more
03-11 20:39:47.167: E/AndroidRuntime(24934): Caused by: android.content.res.Resources$NotFoundException: File res/drawable-v11/abc_btn_checkbox_checked_mtrl.xml from drawable resource ID #0x7f020004
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.content.res.Resources.loadDrawable(Resources.java:2149)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.content.res.MiuiResources.loadDrawable(MiuiResources.java:387)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.content.res.Resources.loadDrawable(Resources.java:2072)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.content.res.Resources.getDrawable(Resources.java:710)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:176)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:939)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:879)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.content.res.Resources.createFromXml(Resources.java:2525)
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.content.res.Resources.loadDrawable(Resources.java:2145)
03-11 20:39:47.167: E/AndroidRuntime(24934): ... 33 more
03-11 20:39:47.167: E/AndroidRuntime(24934): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #17: invalid drawable tag vector
03-11 20:39:47.167: E/AndroidRuntime(24934): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:9
Can someone help me fix this.

I'm assuming you've updated to v23.2 of the support library. I did the same and I had the very same issue. Here's how i fixed it, hope it works for you as well.
1) Update to the latest version of Gradle (1.5.0 as of posting this) from the Android Tools repo: ensure you have this in your Build.gradle file (the one outside all modules).
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
2) If you're using Android Studio 1.4, stop it from generating .png files from vector drawables at run time and use the support libraries, support-vector-drawable and animated-vector-drawable, to do the same instead. Add this to your Build gradle INSIDE your 'app' module
android {
defaultConfig {
generatedDensities = []
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
Also refer http://android-developers.blogspot.in/2016/02/android-support-library-232.html

Upgrading Android Design Support Library (com.android.support:design) from 23.2.0 to 23.2.1 may help solve the problem.

Upgrade support library to last version (23).
This exception it cause by android.content.res.Resources$NotFoundException: File res/drawable/abc_btn_check_material.xml, this is an element from last version of support library
I think you must migrate to AndroidStudio if you are beginner on Android, Eclipse stopped having support google in December 2015
PD: sorry for my english

Related

My program continuous gives error. Can you help me? I have tried so hard but didn't improve the error [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
03-11 15:03:32.743: E/AndroidRuntime(1556): FATAL EXCEPTION: main
03-11 15:03:32.743: E/AndroidRuntime(1556): Process: com.example.takipci, PID: 1556
03-11 15:03:32.743: E/AndroidRuntime(1556): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.takipci/com.example.takipci.AyarlarActivity}: java.lang.RuntimeException: Subclasses of PreferenceActivity must override isValidFragment(String) to verify that the Fragment class is valid! com.example.takipci.AyarlarActivity has not checked if fragment com.example.takipci.fragment.GizlilikPreferencesFragment is valid.
03-11 15:03:32.743: E/AndroidRuntime(1556): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
03-11 15:03:32.743: E/AndroidRuntime(1556): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
03-11 15:03:32.743: E/AndroidRuntime(1556): at android.app.ActivityThread.access$800(ActivityThread.java:135)
03-11 15:03:32.743: E/AndroidRuntime(1556): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
03-11 15:03:32.743: E/AndroidRuntime(1556): at android.os.Handler.dispatchMessage(Handler.java:102)
03-11 15:03:32.743: E/AndroidRuntime(1556): at android.os.Looper.loop(Looper.java:136)
03-11 15:03:32.743: E/AndroidRuntime(1556): at android.app.ActivityThread.main(ActivityThread.java:5017)
03-11 15:03:32.743: E/AndroidRuntime(1556): at java.lang.reflect.Method.invokeNative(Native Method)
03-11 15:03:32.743: E/AndroidRuntime(1556): at java.lang.reflect.Method.invoke(Method.java:515)
03-11 15:03:32.743: E/AndroidRuntime(1556): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-11 15:03:32.743: E/AndroidRuntime(1556): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-11 15:03:32.743: E/AndroidRuntime(1556): at dalvik.system.NativeStart.main(Native Method)
03-11 15:03:32.743: E/AndroidRuntime(1556): Caused by: java.lang.RuntimeException: Subclasses of PreferenceActivity must override isValidFragment(String) to verify that the Fragment class is valid! com.example.takipci.AyarlarActivity has not checked if fragment com.example.takipci.fragment.GizlilikPreferencesFragment is valid.
03-11 15:03:32.743: E/AndroidRuntime(1556): at android.preference.PreferenceActivity.isValidFragment(PreferenceActivity.java:898)
03-11 15:03:32.743: E/AndroidRuntime(1556): at android.preference.PreferenceActivity.switchToHeaderInner(PreferenceActivity.java:1179)
03-11 15:03:32.743: E/AndroidRuntime(1556): at android.preference.PreferenceActivity.switchToHeader(PreferenceActivity.java:1199)
03-11 15:03:32.743: E/AndroidRuntime(1556): at android.preference.PreferenceActivity.onCreate(PreferenceActivity.java:545)
03-11 15:03:32.743: E/AndroidRuntime(1556): at com.example.takipci.AyarlarActivity.onCreate(AyarlarActivity.java:20)
03-11 15:03:32.743: E/AndroidRuntime(1556): at android.app.Activity.performCreate(Activity.java:5231)
03-11 15:03:32.743: E/AndroidRuntime(1556): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
03-11 15:03:32.743: E/AndroidRuntime(1556): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
03-11 15:03:32.743: E/AndroidRuntime(1556): ... 11 more
The exception states:
Subclasses of PreferenceActivity must override isValidFragment(String)
to verify that the Fragment class is valid!
com.example.takipci.AyarlarActivity has not checked if fragment
com.example.takipci.fragment.GizlilikPreferencesFragment is valid.
In your AyarlarActivity you need to add something like the following:
#Override
protected boolean isValidFragment(String fragmentName) {
return GizlilikPreferencesFragment.class.getName().equals(fragmentName)
|| super.isValidFragment(fragmentName);
}
Try to change your API version to 18 or lower, it seems to be a KitKat security restriction
<uses-sdk android:targetSdkVersion="18" />

Vitamio FileNotFoundException

I am trying to use vitamio to play stream hls. it contained error when i play stream
03-11 16:12:25.836: E/Vitamio[Player](344): isNativeLibsInited
03-11 16:12:25.836: E/Vitamio[Player](344): java.io.FileNotFoundException: /data/data/com.example.esporttv/libs/.lock (No such file or directory)
03-11 16:12:25.836: E/Vitamio[Player](344): at org.apache.harmony.luni.platform.OSFileSystem.open(Native Method)
03-11 16:12:25.836: E/Vitamio[Player](344): at dalvik.system.BlockGuard$WrappedFileSystem.open(BlockGuard.java:232)
03-11 16:12:25.836: E/Vitamio[Player](344): at java.io.FileInputStream.<init>(FileInputStream.java:80)
03-11 16:12:25.836: E/Vitamio[Player](344): at java.io.FileReader.<init>(FileReader.java:42)
03-11 16:12:25.836: E/Vitamio[Player](344): at io.vov.vitamio.Vitamio.isInitialized(Vitamio.java:128)
03-11 16:12:25.836: E/Vitamio[Player](344): at io.vov.vitamio.LibsChecker.checkVitamioLibs(LibsChecker.java:40)
03-11 16:12:25.836: E/Vitamio[Player](344): at com.example.esporttv.Player$2.onClick(Player.java:97)
03-11 16:12:25.836: E/Vitamio[Player](344): at android.view.View.performClick(View.java:2485)
03-11 16:12:25.836: E/Vitamio[Player](344): at android.view.View$PerformClick.run(View.java:9080)
03-11 16:12:25.836: E/Vitamio[Player](344): at android.os.Handler.handleCallback(Handler.java:587)
03-11 16:12:25.836: E/Vitamio[Player](344): at android.os.Handler.dispatchMessage(Handler.java:92)
03-11 16:12:25.836: E/Vitamio[Player](344): at android.os.Looper.loop(Looper.java:123)
03-11 16:12:25.836: E/Vitamio[Player](344): at android.app.ActivityThread.main(ActivityThread.java:3683)
03-11 16:12:25.836: E/Vitamio[Player](344): at java.lang.reflect.Method.invokeNative(Native Method)
03-11 16:12:25.836: E/Vitamio[Player](344): at java.lang.reflect.Method.invoke(Method.java:507)
03-11 16:12:25.836: E/Vitamio[Player](344): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-11 16:12:25.836: E/Vitamio[Player](344): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-11 16:12:25.836: E/Vitamio[Player](344): at dalvik.system.NativeStart.main(Native Method)
03-11 16:12:26.166: E/Vitamio[Player](344): isNativeLibsInited
03-11 16:12:26.166: E/Vitamio[Player](344): java.io.FileNotFoundException: /data/data/com.example.esporttv/libs/.lock (No such file or directory)
03-11 16:12:26.166: E/Vitamio[Player](344): at org.apache.harmony.luni.platform.OSFileSystem.open(Native Method)
03-11 16:12:26.166: E/Vitamio[Player](344): at dalvik.system.BlockGuard$WrappedFileSystem.open(BlockGuard.java:232)
03-11 16:12:26.166: E/Vitamio[Player](344): at java.io.FileInputStream.<init>(FileInputStream.java:80)
03-11 16:12:26.166: E/Vitamio[Player](344): at java.io.FileReader.<init>(FileReader.java:42)
03-11 16:12:26.166: E/Vitamio[Player](344): at io.vov.vitamio.Vitamio.isInitialized(Vitamio.java:128)
03-11 16:12:26.166: E/Vitamio[Player](344): at io.vov.vitamio.Vitamio.initialize(Vitamio.java:102)
03-11 16:12:26.166: E/Vitamio[Player](344): at io.vov.vitamio.activity.InitActivity$1.doInBackground(InitActivity.java:55)
03-11 16:12:26.166: E/Vitamio[Player](344): at io.vov.vitamio.activity.InitActivity$1.doInBackground(InitActivity.java:1)
03-11 16:12:26.166: E/Vitamio[Player](344): at android.os.AsyncTask$2.call(AsyncTask.java:185)
03-11 16:12:26.166: E/Vitamio[Player](344): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
03-11 16:12:26.166: E/Vitamio[Player](344): at java.util.concurrent.FutureTask.run(FutureTask.java:138)
03-11 16:12:26.166: E/Vitamio[Player](344): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
03-11 16:12:26.166: E/Vitamio[Player](344): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
03-11 16:12:26.166: E/Vitamio[Player](344): at java.lang.Thread.run(Thread.java:1019)
please help me. thanks
You are giving the file
/data/data/com.example.esporttv/libs/.lock
as a streaming source. You should always check if the file exists using file.exists() function.
Can you also post the lines where you initializee the player?
If you are using Android Studio, here is the solution, original article here:
Create a folder called “lib” (must be exactly this name)
Create subfolders in lib with desired architecture name such as
“armeabi-v7a”, “armeabi” etc.
Put all your *.so file in the just created folder. Now your folder structure should be like this:
lib\armeabi-v7a
...
lib\armeabi
Zip the lib folder into a file, e.g. abc.zip;
Rename this abc.zip –> abc.jar
Copy this abc.jar to your project subfolder, anywhere should do, but
I would typically put it in the app\libs\abc.jar
In the build.gradle, add below line.
That is it!
dependencies {
compile files(‘libs/abc.jar’)
…
}

ArrrayAdapter requires resourceID to be a text view

The goal of this project of mine is to update a spinner dynamically with user input. Unfortunately I'm losing this battle. Logcat keeps throwing the resource ID error at me, HOWEVER, I don't understand why it's only thrown on button press, wouldn't it be thrown after onCreate, if that's where the problem is?
Eclipse (via ctrl + space) tells me the to specify the Resource ID of the layout CONTAINING the TextView. Which I also don't even understand why I would need a textview, if I'm just handling an array and a spinner. AndroidDevelopment site also says the same. I'm just confused.So, my question is, what does this error mean, and what am I doing wrong?
I BELIEVE this is the line in question:
list = new ArrayAdapter<String>(this,R.layout.settings,items);
This is the .java
package com.example.thepicker;
import java.util.ArrayList;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Spinner;
public class Settings extends Activity implements OnClickListener{
EditText getit;
ImageButton giveit;
Spinner thelist;
ArrayList<String> items;
ArrayAdapter<String> list;
String transit;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings);
items = new ArrayList<String>();
list = new ArrayAdapter<String>(this,R.layout.settings,items);
getit = (EditText) findViewById(R.id.getit);
giveit = (ImageButton) findViewById(R.id.giveit);
thelist = (Spinner) findViewById(R.id.thelist);
thelist.setAdapter(list);
giveit.setOnClickListener(this);
}
#Override
public void onClick(View v) {
String transit = getit.getText().toString();
items.add(transit);
list.insert(transit, 0);
list.notifyDataSetChanged();
}
}
This is the logcat
03-11 01:39:25.682: E/Trace(1722): error opening trace file: No such file or directory (2)
03-11 01:39:26.452: D/libEGL(1722): loaded /system/lib/egl/libEGL_emulation.so
03-11 01:39:26.532: D/(1722): HostConnection::get() New Host Connection established 0x556a6180, tid 1722
03-11 01:39:26.602: D/libEGL(1722): loaded /system/lib/egl/libGLESv1_CM_emulation.so
03-11 01:39:26.623: D/libEGL(1722): loaded /system/lib/egl/libGLESv2_emulation.so
03-11 01:39:26.761: W/EGL_emulation(1722): eglSurfaceAttrib not implemented
03-11 01:39:26.772: D/OpenGLRenderer(1722): Enabling debug mode 0
03-11 01:39:30.483: W/EGL_emulation(1722): eglSurfaceAttrib not implemented
03-11 01:39:36.412: E/ArrayAdapter(1722): You must supply a resource ID for a TextView
03-11 01:39:36.412: D/AndroidRuntime(1722): Shutting down VM
03-11 01:39:36.423: W/dalvikvm(1722): threadid=1: thread exiting with uncaught exception (group=0x2bd39930)
03-11 01:39:36.562: E/AndroidRuntime(1722): FATAL EXCEPTION: main
03-11 01:39:36.562: E/AndroidRuntime(1722): java.lang.IllegalStateException: ArrayAdapter requires the resource ID to be a TextView
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:386)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.AbsSpinner.onMeasure(AbsSpinner.java:193)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.Spinner.onMeasure(Spinner.java:439)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.View.measure(View.java:15513)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:645)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:425)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.View.measure(View.java:15513)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4827)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.View.measure(View.java:15513)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.View.measure(View.java:15513)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4827)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
03-11 01:39:36.562: E/AndroidRuntime(1722): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2176)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.View.measure(View.java:15513)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1874)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1089)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1265)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.Choreographer.doFrame(Choreographer.java:532)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.os.Handler.handleCallback(Handler.java:725)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.os.Handler.dispatchMessage(Handler.java:92)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.os.Looper.loop(Looper.java:137)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.app.ActivityThread.main(ActivityThread.java:5039)
03-11 01:39:36.562: E/AndroidRuntime(1722): at java.lang.reflect.Method.invokeNative(Native Method)
03-11 01:39:36.562: E/AndroidRuntime(1722): at java.lang.reflect.Method.invoke(Method.java:511)
03-11 01:39:36.562: E/AndroidRuntime(1722): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-11 01:39:36.562: E/AndroidRuntime(1722): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-11 01:39:36.562: E/AndroidRuntime(1722): at dalvik.system.NativeStart.main(Native Method)
03-11 01:39:36.562: E/AndroidRuntime(1722): Caused by: java.lang.ClassCastException: android.widget.RelativeLayout cannot be cast to android.widget.TextView
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:379)
03-11 01:39:36.562: E/AndroidRuntime(1722): ... 35 more
03-11 01:39:36.682: D/dalvikvm(1722): GC_CONCURRENT freed 188K, 4% free 6367K/6596K, paused 90ms+4ms, total 255ms
03-11 01:39:40.702: I/Process(1722): Sending signal. PID: 1722 SIG: 9
03-11 01:39:41.192: E/Trace(1747): error opening trace file: No such file or directory (2)
03-11 01:39:41.992: D/libEGL(1747): loaded /system/lib/egl/libEGL_emulation.so
03-11 01:39:42.092: D/(1747): HostConnection::get() New Host Connection established 0x556a6180, tid 1747
03-11 01:39:42.376: D/libEGL(1747): loaded /system/lib/egl/libGLESv1_CM_emulation.so
03-11 01:39:42.394: D/libEGL(1747): loaded /system/lib/egl/libGLESv2_emulation.so
03-11 01:39:42.674: W/EGL_emulation(1747): eglSurfaceAttrib not implemented
03-11 01:39:43.465: D/OpenGLRenderer(1747): Enabling debug mode 0
I suspect the problem to be in the line:
list = new ArrayAdapter<String>(this,R.layout.settings,items);
please try to replace R.layout.settings with android.R.layout.simple_spinner_item
second parameter is a resource identifier, that should point to the TextView with id="#android/text1"(that is what Android expects)
android.R.layout.simple_spinner_item corresponds to predefined TextView layout, that is located in the SDK folder(try to look into the folder, where SDK is installed: <SDK_FOLDER>/platforms/<select_any_platform_by_api_level>/data/res/layout/simple_spinner_item.xml, there are some pretty nice predefined layouts, that should help you understand the logic)
Since ArrayAdapter requires a TextView, as the exception says, you have two options:
Change R.layout.settings to android.R.layout.simple_spinner_item.
Create your own Adapter subclass which inflates your custom layout.

Is there a way to see a complete stack trace from android?

When I get an uncaught exception in my app and the trace prints to the logcat, is there anyway to make the entire trace print out? At the end of the trace it always has something like "...10 more".
Example:
03-11 16:25:53.572: ERROR/AndroidRuntime(3297): Caused by: java.lang.ClassNotFoundException: net.notify.notifymdm.listeners.PackageInstallerReceiver in loader dalvik.system.PathClassLoader[/data/app/net.notify.notifymdm-2.apk]
03-11 16:25:53.572: ERROR/AndroidRuntime(3297): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
03-11 16:25:53.572: ERROR/AndroidRuntime(3297): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
03-11 16:25:53.572: ERROR/AndroidRuntime(3297): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
03-11 16:25:53.572: ERROR/AndroidRuntime(3297): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2780)
03-11 16:25:53.572: ERROR/AndroidRuntime(3297): ... 10 more
Usually the "...N more" represents n more lines of the same error, anyway.
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Throwable.html#printStackTrace%28%29

Not a trusted server certificate...Anybody take on this please

I m getting this error while trying to establish a https connection...
03-11 11:59:39.151: WARN/System.err(4057): javax.net.ssl.SSLException: Not trusted server certificate
03-11 11:59:39.222: WARN/System.err(4057): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:371)
03-11 11:59:39.232: WARN/System.err(4057): at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:92)
03-11 11:59:39.232: WARN/System.err(4057): at org.apache.http.conn.ssl.SSLSocketFactory.createSocket(SSLSocketFactory.java:381)
03-11 11:59:39.241: WARN/System.err(4057): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:164)
03-11 11:59:39.261: WARN/System.err(4057): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
03-11 11:59:39.261: WARN/System.err(4057): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
03-11 11:59:39.270: WARN/System.err(4057): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:348)
03-11 11:59:39.270: WARN/System.err(4057): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
03-11 11:59:39.282: WARN/System.err(4057): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
03-11 11:59:39.282: WARN/System.err(4057): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
03-11 11:59:39.282: WARN/System.err(4057): at com.infy.pdf.MyAccount$3.onDownloadStart(MyAccount.java:82)
03-11 11:59:39.282: WARN/System.err(4057): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:387)
03-11 11:59:39.282: WARN/System.err(4057): at android.os.Handler.dispatchMessage(Handler.java:99)
03-11 11:59:39.282: WARN/System.err(4057): at android.os.Looper.loop(Looper.java:123)
03-11 11:59:39.282: WARN/System.err(4057): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-11 11:59:39.282: WARN/System.err(4057): at java.lang.reflect.Method.invokeNative(Native Method)
03-11 11:59:39.462: DEBUG/NativeCrypto(4057): Freeing OpenSSL session
03-11 11:59:39.472: DEBUG/dalvikvm(4057): GC_FOR_MALLOC freed 12447 objects / 621928 bytes in 184ms
03-11 11:59:39.491: WARN/System.err(4057): at java.lang.reflect.Method.invoke(Method.java:521)
03-11 11:59:39.491: WARN/System.err(4057): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-11 11:59:39.501: WARN/System.err(4057): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-11 11:59:39.501: WARN/System.err(4057): at dalvik.system.NativeStart.main(Native Method)
03-11 11:59:39.520: WARN/System.err(4057): Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: TrustAnchor for CertPath not found.
03-11 11:59:39.520: WARN/System.err(4057): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:168)
03-11 11:59:39.532: WARN/System.err(4057): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:366)
03-11 11:59:39.540: WARN/System.err(4057): ... 19 more
03-11 11:59:39.540: WARN/System.err(4057): Caused by: java.security.cert.CertPathValidatorException: TrustAnchor for CertPath not found.
03-11 11:59:39.631: WARN/System.err(4057): at org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi.engineValidate(PKIXCertPathValidatorSpi.java:149)
03-11 11:59:39.631: WARN/System.err(4057): at java.security.cert.CertPathValidator.validate(CertPathValidator.java:202)
03-11 11:59:39.631: WARN/System.err(4057): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:164)
Does anybody have any idea how to tackle this error..
Probably self signed key problem.
Https Connection Android
Self-signed SSL acceptance on Android

Categories

Resources