android application error 5 - java

I try to implement an application based on rscm (middleware). When I try to run on emulator, I get the errors listed below:
Error :03-27 16:58:20.490: E/Trace(1508): error opening trace file: No
such file or directory (2)
03-27 21:53:21.610: D/AndroidRuntime(3803): Shutting down VM 03-27
21:53:21.610: W/dalvikvm(3803): threadid=1: thread exiting with
uncaught exception (group=0x40a71930) 03-27 21:53:21.760:
E/AndroidRuntime(3803): FATAL EXCEPTION: main 03-27 21:53:21.760:
E/AndroidRuntime(3803): java.lang.RuntimeException: Unable to
instantiate activity
ComponentInfo{com.example.context_application/com.example.context_application.MyContextAwareActivity}:
java.lang.ClassNotFoundException: Didn't find class
"com.example.context_application.MyContextAwareActivity" on path:
/data/app/com.example.context_application-2.apk 03-27 21:53:21.760:
E/AndroidRuntime(3803): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
03-27 21:53:21.760: E/AndroidRuntime(3803): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-27 21:53:21.760: E/AndroidRuntime(3803): at
android.app.ActivityThread.access$600(ActivityThread.java:141) 03-27
21:53:21.760: E/AndroidRuntime(3803): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-27 21:53:21.760: E/AndroidRuntime(3803): at
android.os.Handler.dispatchMessage(Handler.java:99) 03-27
21:53:21.760: E/AndroidRuntime(3803): at
android.os.Looper.loop(Looper.java:137) 03-27 21:53:21.760:
E/AndroidRuntime(3803): at
android.app.ActivityThread.main(ActivityThread.java:5041) 03-27
21:53:21.760: E/AndroidRuntime(3803): at
java.lang.reflect.Method.invokeNative(Native Method) 03-27
21:53:21.760: E/AndroidRuntime(3803): at
java.lang.reflect.Method.invoke(Method.java:511) 03-27 21:53:21.760:
E/AndroidRuntime(3803): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-27 21:53:21.760: E/AndroidRuntime(3803): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 03-27
21:53:21.760: E/AndroidRuntime(3803): at
dalvik.system.NativeStart.main(Native Method) 03-27 21:53:21.760:
E/AndroidRuntime(3803): Caused by: java.lang.ClassNotFoundException:
Didn't find class
"com.example.context_application.MyContextAwareActivity" on path:
/data/app/com.example.context_application-2.apk 03-27 21:53:21.760:
E/AndroidRuntime(3803): at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
03-27 21:53:21.760: E/AndroidRuntime(3803): at
java.lang.ClassLoader.loadClass(ClassLoader.java:501) 03-27
21:53:21.760: E/AndroidRuntime(3803): at
java.lang.ClassLoader.loadClass(ClassLoader.java:461) 03-27
21:53:21.760: E/AndroidRuntime(3803): at
android.app.Instrumentation.newActivity(Instrumentation.java:1054)
03-27 21:53:21.760: E/AndroidRuntime(3803): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
03-27 21:53:21.760: E/AndroidRuntime(3803): ... 11 more
Can anyone help?
package com.example.context;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
import org.aspectsense.rscm.ContextValue;
import org.aspectsense.rscm.context.client.ContextListenerActivity;
import org.json.JSONException;
import java.util.Date;
public class MyContextAwareActivity extends ContextListenerActivity
{
#Override public String[] getRequestedScopes()
{
return new String[] { "battery.level" };
}
private TextView messageTextView;
#Override protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
messageTextView = new TextView(this);
setContentView(messageTextView);
appendMessage("Activity created");
}
private void appendMessage(final String message)
{
final String currentMessage = messageTextView.getText().toString();
messageTextView.setText(currentMessage + "\n" + message);
}
#Override public void onContextValueChanged(ContextValue contextValue)
{
try
{
appendMessage(new Date() + ": The battery level is " + contextValue.getValueAsInteger() + "%");
}
catch (JSONException jsone)
{
Toast.makeText(this, "Error while displaying context event: " + contextValue, Toast.LENGTH_SHORT).show();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.context"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.context.MyContextAwareActivity"
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>
</manifest>

You are telling it to write to external storage. Have you set up an SD card in eclipse?
Do any of these answers help? error opening trace file: No such file or directory (2)

Related

An error appear when execute android app

I try to reproduce some videos in a sequence, this is the code, and the error message. I create the sd card in eclipse with the option Run -> Debug Configurations, is a 2GB sd card. I copied some videos to the sd card. So, I appreciate your help. Thanks.
MovieG.java
package com.example.movieg;
import java.io.File;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.widget.MediaController;
import android.widget.VideoView;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
public class MovieG extends Activity {
public VideoView videoView;
public String ex_name;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_movie_g);
ex_name = getIntent().getExtras().getString("video_name");
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
videoView.setMediaController(new MediaController(this));
handler.sendEmptyMessage(1);
}
#SuppressLint("HandlerLeak")
Handler handler = new Handler(){
public void handleMessage(Message msg){
int pos=msg.what;
if (pos == 1){
File ex_name = null;
videoView.setVideoPath(Environment.getExternalStorageDirectory()+"/"+ex_name+".mp4");
videoView.requestFocus();
videoView.start();
Log.d("Before Video Finish", "i m in before video finish");
videoView.setOnCompletionListener(new OnCompletionListener() {
#Override
public void onCompletion(MediaPlayer mp) {
finish();
}
});
}
}
};
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.movie_g, menu);
return true;
}
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.movieg"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name="com.example.movieg.MovieG"
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>
</manifest>
Error Message
02-24 21:42:54.916: D/AndroidRuntime(278): Shutting down VM
02-24 21:42:54.916: W/dalvikvm(278): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
02-24 21:42:54.946: E/AndroidRuntime(278): FATAL EXCEPTION: main
02-24 21:42:54.946: E/AndroidRuntime(278): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.movieg/com.example.movieg.MovieG}: java.lang.NullPointerException
02-24 21:42:54.946: E/AndroidRuntime(278): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
02-24 21:42:54.946: E/AndroidRuntime(278): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
02-24 21:42:54.946: E/AndroidRuntime(278): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
02-24 21:42:54.946: E/AndroidRuntime(278): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
02-24 21:42:54.946: E/AndroidRuntime(278): at android.os.Handler.dispatchMessage(Handler.java:99)
02-24 21:42:54.946: E/AndroidRuntime(278): at android.os.Looper.loop(Looper.java:123)
02-24 21:42:54.946: E/AndroidRuntime(278): at android.app.ActivityThread.main(ActivityThread.java:4627)
02-24 21:42:54.946: E/AndroidRuntime(278): at java.lang.reflect.Method.invokeNative(Native Method)
02-24 21:42:54.946: E/AndroidRuntime(278): at java.lang.reflect.Method.invoke(Method.java:521)
02-24 21:42:54.946: E/AndroidRuntime(278): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-24 21:42:54.946: E/AndroidRuntime(278): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-24 21:42:54.946: E/AndroidRuntime(278): at dalvik.system.NativeStart.main(Native Method)
02-24 21:42:54.946: E/AndroidRuntime(278): Caused by: java.lang.NullPointerException
02-24 21:42:54.946: E/AndroidRuntime(278): at com.example.movieg.MovieG.onCreate(MovieG.java:28)
02-24 21:42:54.946: E/AndroidRuntime(278): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-24 21:42:54.946: E/AndroidRuntime(278): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
02-24 21:42:54.946: E/AndroidRuntime(278): ... 11 more
You should verify that getIntent() has extras:
if (getIntent().getExtras() != null)
ex_name = getIntent().getExtras().getString("video_name");
You then need to cater for ex_name being null later in the code.
Second thing is, you never initialise videoView variable. You need to create an instance of it before it's used in onCreate().
You have not initialize the videoview:
videoView =(VideoView)findViewById(R.id.your_id);
before 28 th line

unfortunately android appname has stopped [duplicate]

This question already has answers here:
After Google Play Service update to version 13 I got an error
(8 answers)
Closed 9 years ago.
Yesterday I updated my eclipse. Before I update the eclipse, my application ran correctly but after I updated the eclipse when I run the application,I have an error,
MY LOGCAT
11-02 04:50:32.548: D/AndroidRuntime(2161): Shutting down VM 11-02 04:50:32.548: W/dalvikvm(2161): threadid=1: thread exiting with
uncaught exception (group=0x40a71930) 11-02 04:50:32.609:
E/AndroidRuntime(2161): FATAL EXCEPTION: main 11-02 04:50:32.609:
E/AndroidRuntime(2161): java.lang.RuntimeException: Unable to start
activity
ComponentInfo{com.vindypratama.tempatwisata/com.vindypratama.tempatwisata.MainMapActivity}:
android.view.InflateException: Binary XML file line #7: Error
inflating class fragment 11-02 04:50:32.609: E/AndroidRuntime(2161):
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
11-02 04:50:32.609: E/AndroidRuntime(2161): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
11-02 04:50:32.609: E/AndroidRuntime(2161): at
android.app.ActivityThread.access$600(ActivityThread.java:141) 11-02
04:50:32.609: E/AndroidRuntime(2161): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
11-02 04:50:32.609: E/AndroidRuntime(2161): at
android.os.Handler.dispatchMessage(Handler.java:99) 11-02
04:50:32.609: E/AndroidRuntime(2161): at
android.os.Looper.loop(Looper.java:137) 11-02 04:50:32.609:
E/AndroidRuntime(2161): at
android.app.ActivityThread.main(ActivityThread.java:5041) 11-02
04:50:32.609: E/AndroidRuntime(2161): at
java.lang.reflect.Method.invokeNative(Native Method) 11-02
04:50:32.609: E/AndroidRuntime(2161): at
java.lang.reflect.Method.invoke(Method.java:511) 11-02 04:50:32.609:
E/AndroidRuntime(2161): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
11-02 04:50:32.609: E/AndroidRuntime(2161): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 11-02
04:50:32.609: E/AndroidRuntime(2161): at
dalvik.system.NativeStart.main(Native Method) 11-02 04:50:32.609:
E/AndroidRuntime(2161): Caused by: android.view.InflateException:
Binary XML file line #7: Error inflating class fragment 11-02
04:50:32.609: E/AndroidRuntime(2161): at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
11-02 04:50:32.609: E/AndroidRuntime(2161): at
android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 11-02
04:50:32.609: E/AndroidRuntime(2161): at
android.view.LayoutInflater.inflate(LayoutInflater.java:489) 11-02
04:50:32.609: E/AndroidRuntime(2161): at
android.view.LayoutInflater.inflate(LayoutInflater.java:396) 11-02
04:50:32.609: E/AndroidRuntime(2161): at
android.view.LayoutInflater.inflate(LayoutInflater.java:352) 11-02
04:50:32.609: E/AndroidRuntime(2161): at
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
11-02 04:50:32.609: E/AndroidRuntime(2161): at
android.app.Activity.setContentView(Activity.java:1881) 11-02
04:50:32.609: E/AndroidRuntime(2161): at
com.vindypratama.tempatwisata.MainMapActivity.onCreate(MainMapActivity.java:25)
11-02 04:50:32.609: E/AndroidRuntime(2161): at
android.app.Activity.performCreate(Activity.java:5104) 11-02
04:50:32.609: E/AndroidRuntime(2161): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
11-02 04:50:32.609: E/AndroidRuntime(2161): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
11-02 04:50:32.609: E/AndroidRuntime(2161): ... 11 more 11-02
04:50:32.609: E/AndroidRuntime(2161): Caused by:
java.lang.IllegalStateException: The meta-data tag in your app's
AndroidManifest.xml does not have the right value. Expected 4030500
but found 0. You must have the following declaration within the
element: 11-02
04:50:32.609: E/AndroidRuntime(2161): at
com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
11-02 04:50:32.609: E/AndroidRuntime(2161): at
com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown
Source) 11-02 04:50:32.609: E/AndroidRuntime(2161): at
com.google.android.gms.maps.internal.q.v(Unknown Source) 11-02
04:50:32.609: E/AndroidRuntime(2161): at
com.google.android.gms.maps.internal.q.u(Unknown Source) 11-02
04:50:32.609: E/AndroidRuntime(2161): at
com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
11-02 04:50:32.609: E/AndroidRuntime(2161): at
com.google.android.gms.maps.SupportMapFragment$b.cE(Unknown Source)
11-02 04:50:32.609: E/AndroidRuntime(2161): at
com.google.android.gms.maps.SupportMapFragment$b.a(Unknown Source)
11-02 04:50:32.609: E/AndroidRuntime(2161): at
com.google.android.gms.dynamic.a.a(Unknown Source) 11-02 04:50:32.609:
E/AndroidRuntime(2161): at
com.google.android.gms.dynamic.a.onInflate(Unknown Source) 11-02
04:50:32.609: E/AndroidRuntime(2161): at
com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown
Source) 11-02 04:50:32.609: E/AndroidRuntime(2161): at
android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:290)
11-02 04:50:32.609: E/AndroidRuntime(2161): at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
11-02 04:50:32.609: E/AndroidRuntime(2161): ... 21 more 11-02
04:50:45.858: I/Process(2161): Sending signal. PID: 2161 SIG: 9
My activity.java
package org.lucasr.twowayview;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import android.content.Context;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.view.Menu;
public class MainMapActivity extends FragmentActivity
{
private GoogleMap map;
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_map);
setupMapIfNeeded();
}
private void setupMapIfNeeded()
{
if(map == null)
{
FragmentManager fragmentManager = getSupportFragmentManager();
SupportMapFragment supportMapFragment = (SupportMapFragment) fragmentManager.findFragmentById(R.id.maps);
map = supportMapFragment.getMap();
if(map != null)
{
setupMap();
}
}
}
private void setupMap()
{
map.setMyLocationEnabled(true);
moveToMyLocation();
}
private void moveToMyLocation()
{
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
location = locationManager.getLastKnownLocation(locationManager.getBestProvider(criteria, false));
if ( location != null)
{
map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(), location.getLongitude()), 13));
}
}
#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_map, menu);
return true;
}
protected void onResume()
{
super.onResume();
int resCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
if( resCode != ConnectionResult.SUCCESS)
{
GooglePlayServicesUtil.getErrorDialog(resCode, this, 1);
}
}
}
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.vindypratama.tempatwisata"
android:versionCode="1"
android:versionName="1.0" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<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" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.vindypratama.tempatwisata.permission.MAPS_RECEIVE" />
<permission
android:name="com.vindypratama.tempatwisata.permission.MAPS_RECEIVE"
android:protectionLevel="signature" >
</permission><uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDcosD0fQsQcYCEiDDkRxP6ZRACPf-svaw" />
<activity
android:name="com.vindypratama.tempatwisata.MainMapActivity"
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><manifest>
</manifest>
xml file:
<fragment
android:id="#+id/maps"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"
/>
Try to use Project -> Clean. That actually helped me.
EDIT: If that doesn't help, try to relaunch Eclipse after Clean.
you are using a custom class - twowayview. fix you build path. check if you have checked the added jars in your build path. clean the project. delete bin folder.clear/refresh the project. it will work

"findLibrary returned null" on Android while connecting to deezer's player-module

I'm trying to establish a player-module from an android device to the music-streaming-platform deezer. This is the Tutorial I followed: http://developers.deezer.com/sdk/android#using-player-module-2
(See the question at the bottom)
Here's my code:
package com.example.playertest;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import com.deezer.sdk.DeezerConnect;
import com.deezer.sdk.DeezerConnectImpl;
import com.deezer.sdk.DeezerError;
import com.deezer.sdk.OAuthException;
import com.deezer.sdk.player.Player;
import com.deezer.sdk.player.PlayerFactory;
import com.deezer.sdk.player.TooManyPlayersExceptions;
import com.deezer.sdk.player.impl.DefaultPlayerFactory;
import com.deezer.sdk.player.networkcheck.WifiOnlyNetworkStateChecker;
public class MainActivity extends Activity {
private final static String APP_ID = "XXXXX";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
DeezerConnect connection = new DeezerConnectImpl(APP_ID);
try {
PlayerFactory player = new DefaultPlayerFactory(getApplication(), connection, new WifiOnlyNetworkStateChecker());
Player play = player.createPlayer();
//same as: Player player = new DefaultPlayerFactory(getApplication(), connection, new WifiOnlyNetworkStateChecker()).createPlayer();
} catch (OAuthException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (DeezerError e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (TooManyPlayersExceptions e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
#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;
}
}
The manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.playertest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.playertest.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>
</application>
</manifest>
And here the logcat output:
07-20 12:49:29.755: E/Trace(4186): error opening trace file: No such file or directory (2)
07-20 12:49:30.925: W/dalvikvm(4186): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/deezer/sdk/player/impl/RealPlayerImpl;
07-20 12:49:30.985: W/dalvikvm(4186): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
07-20 12:49:31.125: E/AndroidRuntime(4186): FATAL EXCEPTION: main
07-20 12:49:31.125: E/AndroidRuntime(4186): java.lang.ExceptionInInitializerError
07-20 12:49:31.125: E/AndroidRuntime(4186): at com.deezer.sdk.player.impl.DefaultPlayerFactory.createPlayer(Unknown Source)
07-20 12:49:31.125: E/AndroidRuntime(4186): at com.example.playertest.MainActivity.onCreate(MainActivity.java:29)
07-20 12:49:31.125: E/AndroidRuntime(4186): at android.app.Activity.performCreate(Activity.java:5104)
07-20 12:49:31.125: E/AndroidRuntime(4186): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
07-20 12:49:31.125: E/AndroidRuntime(4186): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
07-20 12:49:31.125: E/AndroidRuntime(4186): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
07-20 12:49:31.125: E/AndroidRuntime(4186): at android.app.ActivityThread.access$600(ActivityThread.java:141)
07-20 12:49:31.125: E/AndroidRuntime(4186): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
07-20 12:49:31.125: E/AndroidRuntime(4186): at android.os.Handler.dispatchMessage(Handler.java:99)
07-20 12:49:31.125: E/AndroidRuntime(4186): at android.os.Looper.loop(Looper.java:137)
07-20 12:49:31.125: E/AndroidRuntime(4186): at android.app.ActivityThread.main(ActivityThread.java:5041)
07-20 12:49:31.125: E/AndroidRuntime(4186): at java.lang.reflect.Method.invokeNative(Native Method)
07-20 12:49:31.125: E/AndroidRuntime(4186): at java.lang.reflect.Method.invoke(Method.java:511)
07-20 12:49:31.125: E/AndroidRuntime(4186): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
07-20 12:49:31.125: E/AndroidRuntime(4186): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
07-20 12:49:31.125: E/AndroidRuntime(4186): at dalvik.system.NativeStart.main(Native Method)
07-20 12:49:31.125: E/AndroidRuntime(4186): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load deezer from loader dalvik.system.PathClassLoader[dexPath=/data/app/com.example.playertest-1.apk,libraryPath=/data/app-lib/com.example.playertest-1]: findLibrary returned null
07-20 12:49:31.125: E/AndroidRuntime(4186): at java.lang.Runtime.loadLibrary(Runtime.java:365)
07-20 12:49:31.125: E/AndroidRuntime(4186): at java.lang.System.loadLibrary(System.java:535)
07-20 12:49:31.125: E/AndroidRuntime(4186): at com.deezer.sdk.player.impl.RealPlayerImpl.<clinit>(Unknown Source)
07-20 12:49:31.125: E/AndroidRuntime(4186): ... 16 more
I'm very confused about this failure, because if I delete the line
Player play = player.createPlayer();
there is no failure and no warning. So this is the interesting point.
I don't get why the returned library at this point is null, because the classes DeezerConnect, DeezerConnectImpl, PlayerFactory, DefaultPlayerFactory and even Player are all in the same library and up to this point everything works fine.
Has anybody an obvious solution for this? Moreover, how can I solve this problem?
did you follow the steps Adding the SDK C library, namely adding the libdeezer.so to your libs/armeabi folder?
This error mostly means that the library is not found on the device, which in your case might mean that it is not packaged with your app.

Unable to instantiate activity componentInfo, Activity declared in Manifest

I was adding the Google Cloud Messaging service to my App and altered my manifest file. I get the following StackTrace.
02-27 18:58:11.282: E/AndroidRuntime(988): FATAL EXCEPTION: main
02-27 18:58:11.282: E/AndroidRuntime(988): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.phptest/com.example.phptest.MainActivity}: java.lang.ClassNotFoundException: com.example.phptest.MainActivity
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.ActivityThread.access$600(ActivityThread.java:130)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.os.Handler.dispatchMessage(Handler.java:99)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.os.Looper.loop(Looper.java:137)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.ActivityThread.main(ActivityThread.java:4745)
02-27 18:58:11.282: E/AndroidRuntime(988): at java.lang.reflect.Method.invokeNative(Native Method)
02-27 18:58:11.282: E/AndroidRuntime(988): at java.lang.reflect.Method.invoke(Method.java:511)
02-27 18:58:11.282: E/AndroidRuntime(988): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
02-27 18:58:11.282: E/AndroidRuntime(988): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
02-27 18:58:11.282: E/AndroidRuntime(988): at dalvik.system.NativeStart.main(Native Method)
02-27 18:58:11.282: E/AndroidRuntime(988): Caused by: java.lang.ClassNotFoundException: com.example.phptest.MainActivity
02-27 18:58:11.282: E/AndroidRuntime(988): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
02-27 18:58:11.282: E/AndroidRuntime(988): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
02-27 18:58:11.282: E/AndroidRuntime(988): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
02-27 18:58:11.282: E/AndroidRuntime(988): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
02-27 18:58:11.282: E/AndroidRuntime(988): ... 11 more
Here is my Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.phptest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="16" />
<uses-configuration />
<permission
android:name="com.example.phptest.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.phptest.permission.C2D_MESSAGE" />
<!-- App receives GCM messages. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- GCM connects to Google Services. -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.phptest.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>
<service android:name=".GCMIntentService" />
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.example.phptest" />
</intent-filter>
</receiver>
</application>
</manifest>
MainActivity:
package com.example.phptest;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import com.example.phptest.DeviceLogin.LoginReply;
import com.google.android.gcm.GCMRegistrar;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
public class MainActivity extends Activity implements LoginReply {
String TAG = "Main Activity";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
DeviceLogin d = new DeviceLogin(this);
d.execute("xxxx","12345");
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
final String regId = GCMRegistrar.getRegistrationId(this);
if (regId.equals("")) {
GCMRegistrar.register(this, GCMIntentService.senderId);
} else {
Log.v(TAG, "Already registered");
}
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
public static String makeCall(String scriptName) {
String address = "http://10.0.2.2/" + scriptName + ".php";
HttpPost httpPost = new HttpPost(address);
HttpClient httpClient = new DefaultHttpClient();
StringBuilder total = new StringBuilder();
try {
//httpPost.setEntity(new UrlEncodedFormEntity(params));
// Execute HTTP Post Request
HttpResponse response = httpClient.execute(httpPost);
InputStream is = response.getEntity().getContent();
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
String line = "";
// Read response until the end
while ((line = rd.readLine()) != null) {
total.append(line);
}
// Return full string
System.out.println("TOTAL: " + total.toString());
return total.toString();
} catch (Exception e) {
e.printStackTrace();
}
return "empty";
}
public void onDevicesDownloaded(String login) {
// TODO Auto-generated method stub
}
}
Any ideas?
I have seen Android apps get finicky when the full path is specified in the name attribute unless the package the class is in differs from the one you specify at the top of the manifest file. Try changing it to just ".MainActivity" and see if that makes it happy.
Solution was to clean project, D'oh! xD

Fatal exception: main android eclipse

I have viewed most of the other threads regarding this error but have not found an answer.
I started a new project a couple of weeks ago using a plugin and the example project with the plugin. Added various of my own features and designs and no problems running the project.
Then updated to ADT 17 2 days ago and this seriously messed things up for me. Started getting class path errors to name a few. I then reverted back to adt 16 which fixed the errors and my project compiles fine but as soon as i run it it crashes on the test device.
I have checked that my compliance level is correct, checked library paths, api versions, manifest xml, basically everything. I do not get how something that use to work perfectly can now just not work.
I proceeded to unistall everything and did a reinstall on the sdk's ADT and java, but to no avail, even just trying to run the example project just crashes.
I have aslo uninstalled the app from the device and rbooted the device and cleared the cache. I am at the end of my rope. Like i say, i have checked libraries and everything, its just this runtime error.
I also increased the connection time out, and added "android:installLocation="preferExternal" to my manifest, no change.
Please help, there cant be an issue with the code as it worked perfectly.
Please see the code for the starting activity:
package com.yourcompany.junaioplugin.template;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import com.yourcompany.junaioplugin.template.R;
import com.metaio.junaio.plugin.JunaioPlugin;
public class SplashActivity extends Activity
{
static
{
JunaioPlugin.loadNativeLibs();
}
/**
* standard tag used for all the debug messages
*/
public static final String TAG = "junaioPluginTemplate";
/**
* Display log messages with debug priority
*
* #param msg Message to display
* #see Log#d(String, String)
*/
public static void log(String msg)
{
if (msg != null)
Log.d(TAG, msg);
}
/**
* Progress dialog
*/
private ProgressDialog progressDialog;
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView( R.layout.main );
JunaioStarterTask junaioStarter = new JunaioStarterTask();
junaioStarter.execute(1);
}
private class JunaioStarterTask extends AsyncTask<Integer, Integer, Integer>
{
#Override
protected void onPreExecute()
{
progressDialog = ProgressDialog.show(SplashActivity.this, "junaio", "Starting up...");
}
#Override
protected Integer doInBackground(Integer... params)
{
// Set authentication if a private channel is used
// JunaioPlugin.setAuthentication("username", "password");
// Start junaio, this will initialize everything the plugin need
int result = JunaioPlugin.startJunaio(this, getApplicationContext());
return result;
}
#Override
protected void onProgressUpdate(Integer... progress)
{
}
#Override
protected void onPostExecute(Integer result)
{
if (progressDialog != null)
{
progressDialog.cancel();
progressDialog = null;
}
switch (result)
{
case JunaioPlugin.ERROR_EXSTORAGE:
SplashActivity.log("External storage is not available, closing...");
finish();
break;
case JunaioPlugin.ERROR_INSTORAGE:
SplashActivity.log("Internal storage is not available, closing...");
finish();
break;
case JunaioPlugin.CANCELLED:
SplashActivity.log("Starting junaio cancelled");
break;
case JunaioPlugin.SUCCESS:
JunaioPlugin.setAuthentication("junaioTester", "test123");
launchLiveView();
break;
}
}
}
/**
* Launch junaio live view
*/
private void launchLiveView()
{
startActivity(new Intent(this, JunaioARViewTestActivity.class));
finish();
}
#Override
protected void onResume()
{
super.onResume();
}
#Override
protected void onPause()
{
super.onPause();
}
#Override
protected void onStop()
{
super.onStop();
if (progressDialog != null)
{
progressDialog.cancel();
progressDialog = null;
}
}
}
Here is the logcat:
03-27 10:47:47.543: I/dalvikvm(10641): Could not find method com.metaio.junaio.plugin.JunaioPlugin.loadNativeLibs, referenced from method com.yourcompany.junaioplugin.template.SplashActivity.<clinit>
03-27 10:47:47.543: W/dalvikvm(10641): VFY: unable to resolve static method 65: Lcom/metaio/junaio/plugin/JunaioPlugin;.loadNativeLibs ()V
03-27 10:47:47.543: D/dalvikvm(10641): VFY: replacing opcode 0x71 at 0x0000
03-27 10:47:47.543: D/dalvikvm(10641): VFY: dead code 0x0003-0003 in Lcom/yourcompany/junaioplugin/template/SplashActivity;.<clinit> ()V
03-27 10:47:47.543: W/dalvikvm(10641): Unable to resolve superclass of Lcom/yourcompany/junaioplugin/template/JunaioARViewTestActivity; (48)
03-27 10:47:47.543: W/dalvikvm(10641): Link of class 'Lcom/yourcompany/junaioplugin/template/JunaioARViewTestActivity;' failed
03-27 10:47:47.547: E/dalvikvm(10641): Could not find class 'com.yourcompany.junaioplugin.template.JunaioARViewTestActivity', referenced from method com.yourcompany.junaioplugin.template.SplashActivity.launchLiveView
03-27 10:47:47.547: W/dalvikvm(10641): VFY: unable to resolve const-class 78 (Lcom/yourcompany/junaioplugin/template/JunaioARViewTestActivity;) in Lcom/yourcompany/junaioplugin/template/SplashActivity;
03-27 10:47:47.547: D/dalvikvm(10641): VFY: replacing opcode 0x1c at 0x0002
03-27 10:47:47.547: D/dalvikvm(10641): VFY: dead code 0x0004-000d in Lcom/yourcompany/junaioplugin/template/SplashActivity;.launchLiveView ()V
03-27 10:47:47.547: W/dalvikvm(10641): Exception Ljava/lang/NoClassDefFoundError; thrown during Lcom/yourcompany/junaioplugin/template/SplashActivity;.<clinit>
03-27 10:47:47.547: W/dalvikvm(10641): Class init failed in newInstance call (Lcom/yourcompany/junaioplugin/template/SplashActivity;)
03-27 10:47:47.547: D/AndroidRuntime(10641): Shutting down VM
03-27 10:47:47.547: W/dalvikvm(10641): threadid=1: thread exiting with uncaught exception (group=0x4001d7d0)
03-27 10:47:47.555: E/AndroidRuntime(10641): FATAL EXCEPTION: main
03-27 10:47:47.555: E/AndroidRuntime(10641): java.lang.ExceptionInInitializerError
03-27 10:47:47.555: E/AndroidRuntime(10641): at java.lang.Class.newInstanceImpl(Native Method)
03-27 10:47:47.555: E/AndroidRuntime(10641): at java.lang.Class.newInstance(Class.java:1429)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.os.Handler.dispatchMessage(Handler.java:99)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.os.Looper.loop(Looper.java:123)
03-27 10:47:47.555: E/AndroidRuntime(10641): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-27 10:47:47.555: E/AndroidRuntime(10641): at java.lang.reflect.Method.invokeNative(Native Method)
03-27 10:47:47.555: E/AndroidRuntime(10641): at java.lang.reflect.Method.invoke(Method.java:521)
03-27 10:47:47.555: E/AndroidRuntime(10641): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
03-27 10:47:47.555: E/AndroidRuntime(10641): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
03-27 10:47:47.555: E/AndroidRuntime(10641): at dalvik.system.NativeStart.main(Native Method)
03-27 10:47:47.555: E/AndroidRuntime(10641): Caused by: java.lang.NoClassDefFoundError: com.metaio.junaio.plugin.JunaioPlugin
03-27 10:47:47.555: E/AndroidRuntime(10641): at com.yourcompany.junaioplugin.template.SplashActivity.<clinit>(SplashActivity.java:19)
03-27 10:47:47.555: E/AndroidRuntime(10641): ... 15 more
Here is the manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="3"
android:versionName="3.5.1" package="com.yourcompany.junaioplugin.template"
android:installLocation="preferExternal">
<!-- The application must be compiled using Google APIs (Android 3.0) -->
<!-- However, target and min SDK can be 8 (Android 2.2) -->
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<uses-feature android:name="android.hardware.location.gps" android:required="false"/>
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="false"/>
<uses-feature android:name="android.hardware.sensor.compass" android:required="false"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<application
android:label="#string/app_name"
android:icon="#drawable/icon"
android:debuggable="true">
<uses-library android:name="com.google.android.maps" />
<!-- Start screen -->
<activity android:name=".SplashActivity"
android:theme="#style/Theme.Fullscreen"
android:screenOrientation="portrait"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- junaio AR view activity -->
<activity
android:name=".JunaioARViewTestActivity"
android:theme="#style/Theme.Fullscreen"
android:configChanges="orientation"
android:screenOrientation="landscape">
</activity>
<activity
android:name="com.metaio.junaio.plugin.view.POIDetailDialog"
android:theme="#style/Theme.POIDialog"
android:screenOrientation="landscape">
</activity>
<activity
android:name="com.metaio.junaio.plugin.view.WebViewActivity"
android:theme="#style/Theme.Fullscreen"
android:configChanges="orientation">"
</activity>
<activity
android:name="com.metaio.junaio.plugin.view.ImageViewActivity"
android:theme="#style/Theme.Fullscreen"
android:configChanges="orientation">
</activity>
</application>
</manifest>
For me, when I installed ADT 17 I have problems using 3rd party libraries (It kept telling me there were duplications). It turns out that they no longer need to be added to the build path; just kept in a folder in the root of your project called "libs". Could this be the same problem?

Categories