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

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

Related

Unable to use checkbox in eclipse with android adt plugin

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

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

Android maps application not loading (Unexpectedly stopped error)

I am working on my first android project. i am doing a maos based application. Buty when I launch I am getting the following error "application stopped due unexpected error.
here is my code. if anything more is required plz do let me know I wil post them
import com.google.android.maps.MapView;
import android.app.Activity;
import android.os.Bundle;
import android.widget.LinearLayout;
public class map extends Activity {
/** Called when the activity is first created. */
LinearLayout linearLayout;
MapView mapView;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mapView = (MapView)findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
}
}
this is my layout xml. I have given the apikey too.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/mainlayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.google.android.maps.MapView
android:id="#+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="Api key"
/>
</RelativeLayout>
this is my manifest file.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="rrj.map"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<uses-library android:name="com.google.android.maps" />
<activity android:name=".map"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="android.permission.INTERNET">
</uses-permission>
<uses-permission
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="android.permission.ACCESS_FINE_LOCATION">
</uses-permission>
</manifest>
the logcat is down please do help me in pointing out the mistake. I don know how to read the logcat
03-11 00:47:32.856: DEBUG/AndroidRuntime(3209): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
03-11 00:47:32.856: INFO/AndroidRuntime(3209): Heap size: -Xmx18m
03-11 00:47:32.856: DEBUG/AndroidRuntime(3209): CheckJNI is OFF
03-11 00:47:32.861: DEBUG/AndroidRuntime(3209): pLocation:english, pLang: en, pRegn: GB
03-11 00:47:32.866: DEBUG/AndroidRuntime(3209): setted country_code = India
03-11 00:47:32.866: ERROR/AndroidRuntime(3209): /system/csc/sales_code.dat ==> cannot open file
03-11 00:47:32.981: DEBUG/AndroidRuntime(3209): --- registering native functions ---
03-11 00:47:33.206: DEBUG/ddm-heap(3209): Got feature list request
03-11 00:47:33.256: INFO/WynexActivity(1981): WindowOrientationChanged: 0
03-11 00:47:33.371: DEBUG/AndroidRuntime(3209): Shutting down VM
03-11 00:47:33.371: DEBUG/dalvikvm(3209): DestroyJavaVM waiting for non-daemon threads to exit
03-11 00:47:33.371: DEBUG/dalvikvm(3209): DestroyJavaVM shutting VM down
03-11 00:47:33.371: DEBUG/dalvikvm(3209): HeapWorker thread shutting down
03-11 00:47:33.371: DEBUG/dalvikvm(3209): HeapWorker thread has shut down
03-11 00:47:33.376: DEBUG/jdwp(3209): JDWP shutting down net...
03-11 00:47:33.376: INFO/dalvikvm(3209): Debugger has detached; object registry had 1 entries
03-11 00:47:33.381: DEBUG/dalvikvm(3209): VM cleaning up
03-11 00:47:33.391: ERROR/AndroidRuntime(3209): ERROR: thread attach failed
03-11 00:47:33.391: DEBUG/dalvikvm(3209): LinearAlloc 0x0 used 663292 of 5242880 (12%)
03-11 00:47:33.716: DEBUG/AndroidRuntime(3217): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
03-11 00:47:33.716: INFO/AndroidRuntime(3217): Heap size: -Xmx18m
03-11 00:47:33.716: DEBUG/AndroidRuntime(3217): CheckJNI is OFF
03-11 00:47:33.721: DEBUG/AndroidRuntime(3217): pLocation:english, pLang: en, pRegn: GB
03-11 00:47:33.726: DEBUG/AndroidRuntime(3217): setted country_code = India
03-11 00:47:33.726: ERROR/AndroidRuntime(3217): /system/csc/sales_code.dat ==> cannot open file
03-11 00:47:33.886: DEBUG/AndroidRuntime(3217): --- registering native functions ---
03-11 00:47:34.111: DEBUG/ddm-heap(3217): Got feature list request
03-11 00:47:34.281: INFO/ActivityManager(1905): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=rrj.map/.map }
03-11 00:47:34.286: DEBUG/WynexActivity(1981): ----> onSaveInstanceState()false
03-11 00:47:34.286: DEBUG/WynexActivity(1981): ----> OnPause()false
03-11 00:47:34.286: DEBUG/Wynex(1981): ----> OnPauseActivity()
03-11 00:47:34.301: INFO/ActivityManager(1905): Start proc rrj.map for activity rrj.map/.map: pid=3224 uid=10058 gids={3003}
03-11 00:47:34.326: DEBUG/AndroidRuntime(3217): Shutting down VM
03-11 00:47:34.326: DEBUG/dalvikvm(3217): DestroyJavaVM waiting for non-daemon threads to exit
03-11 00:47:34.326: DEBUG/dalvikvm(3217): DestroyJavaVM shutting VM down
03-11 00:47:34.326: DEBUG/dalvikvm(3217): HeapWorker thread shutting down
03-11 00:47:34.331: DEBUG/dalvikvm(3217): HeapWorker thread has shut down
03-11 00:47:34.331: DEBUG/jdwp(3217): JDWP shutting down net...
03-11 00:47:34.331: INFO/dalvikvm(3217): Debugger has detached; object registry had 1 entries
03-11 00:47:34.336: DEBUG/dalvikvm(3217): VM cleaning up
03-11 00:47:34.351: ERROR/AndroidRuntime(3217): ERROR: thread attach failed
03-11 00:47:34.356: DEBUG/dalvikvm(3217): LinearAlloc 0x0 used 673260 of 5242880 (12%)
03-11 00:47:34.421: DEBUG/ddm-heap(3224): Got feature list request
03-11 00:47:34.461: DEBUG/WynexView(1981): (^^) SURFACE DESTROYED
03-11 00:47:34.461: DEBUG/WynexView(1981): (^^) <CONSUMER>: AWKE COMSUMER THREAD TO STOP WORKING
03-11 00:47:34.461: ERROR/WynexView(1981): (^^) <CONSUMER>: THREAD STOP
03-11 00:47:34.471: DEBUG/WynexActivity(1981): ----> onWindowFocusChanged(false)
03-11 00:47:34.471: DEBUG/Wynex(1981): ----> OnWindowFocusChanged()
03-11 00:47:34.596: DEBUG/AndroidRuntime(3224): Shutting down VM
03-11 00:47:34.601: WARN/dalvikvm(3224): threadid=3: thread exiting with uncaught exception (group=0x4001b180)
03-11 00:47:34.601: ERROR/AndroidRuntime(3224): Uncaught handler: thread main exiting due to uncaught exception
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): java.lang.RuntimeException: Unable to start activity ComponentInfo{rrj.map/rrj.map.map}: android.view.InflateException: Binary XML file line #8: Error inflating class com.google.android.maps.MapView
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at android.os.Handler.dispatchMessage(Handler.java:99)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at android.os.Looper.loop(Looper.java:123)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at android.app.ActivityThread.main(ActivityThread.java:4367)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at java.lang.reflect.Method.invokeNative(Native Method)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at java.lang.reflect.Method.invoke(Method.java:521)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at dalvik.system.NativeStart.main(Native Method)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.google.android.maps.MapView
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at android.app.Activity.setContentView(Activity.java:1622)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at rrj.map.map.onCreate(map.java:18)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): ... 11 more
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): Caused by: java.lang.reflect.InvocationTargetException
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at com.google.android.maps.MapView.<init>(MapView.java:238)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at java.lang.reflect.Constructor.constructNative(Native Method)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): ... 21 more
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): Caused by: java.lang.IllegalArgumentException: MapViews can only be created inside instances of MapActivity.
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at com.google.android.maps.MapView.<init>(MapView.java:282)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): at com.google.android.maps.MapView.<init>(MapView.java:255)
03-11 00:47:34.626: ERROR/AndroidRuntime(3224): ... 25 more
What jumps out at me 1st is that map activities should extend MapActivity
Your activity must extend MapActivity and you are missing the Maps Api key in your MapView definition. You can get it here.

Categories

Resources