I downloaded actionbar sherlock library from the main site itself. and i tried to use it in my app.
import com.actionbarsherlock.app.SherlockActivity;
import android.os.Bundle;
public class Sherlockactivity extends SherlockActivity {
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
but when i started the app with the default main.xml layout, i get this exception.
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.android.sherlock/com.android.sherlock.SherlockActivity}: java.lang.ClassNotFoundException: com.android.sherlock.SherlockActivity in loader dalvik.system.PathClassLoader[/data/app/com.android.sherlock-1.apk]
my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.sherlock"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="14" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.Sherlock" >
<activity
android:name=".SherlockActivity"
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>
i just started to use support libraries. have no idea how to solve this.
Thank you
Download sherlock action bar zip.
New->android project from existed source
choose library folder from sherlock bar folder
in the properties of your project, ->android->add library and set the folder that you copy.
See Using an ActionBar in your Android app with ActionBarSherlock.
Related
I've trying create an app which is need Toolbar. I've already add "appcompat_v7.jar" to my project which I've got no result.
I've already review some links below and they couldn't help so.
The Import android.support.v7 cannot be resolved
The import android.support.v7.app cannot be resolved
The Import android.support.v7 cannot be resolved
Here is my "AndroidManifect":
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.tabex"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".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>
Also image from Eclipse:
As you can see other import from v7 works but the Toolbar not. I've really appropriate your help.
Looking at your SDK Manager screenshot, you are using an old version of the Support Library. The Toolbar widget did not get introduced until v21, you are using v20. Upgrade to latest.
I've Upgrade my Android Support Library to Latest version which is 23.0.1 and It's work hundred percent.
I am developing an appliation in Android with the SlidingMenu library. I've imported the project to eclipse and I've linked the library with my project PaperTask. The MainActivity extend from SlidingFragmentActivity that extend from FragmentActivity. I've added the class to the Android Manifest but when I launch the app, the debugger show this exception:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.paper.papertask/com.paper.papertask.activities.MainPaperActivity}:
java.lang.ClassNotFoundException: Didn't find class "com.paper.papertask.activities.MainPaperActivity"
on path: /data/app/com.paper.papertask-2.apk
The android manifest is:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.paper.papertask"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.paper.papertask.activities.MainPaperActivity"
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>
The routes of my class are the correct, but for some reason this not found the class.
Can some one know why this doesn't find the class?
Thanks!
I have two Android projects. One is a library and compiles a jar the other an executable which includes this jar on the build path.
I'm subclassing an activity in the jar in my project but when I start it I'm getting a ClassNotFoundException.
Here's the manifest with the activity in question being MainActivity:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.my.package.MyProject"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<application android:label="#string/app_name"
android:name=".MyApplication"
android:icon="#drawable/ic_launcher"
android:theme="#style/AppTheme">
<activity android:label="#string/app_name"
android:configChanges="orientation|keyboardHidden"
android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
And here is my MainActivity, where the QCARSamples package is found in my jar:
package com.my.package.MyProject;
import java.io.File;
import com.qualcomm.QCARSamples.ImageTargets.GraphicsEngineHook;
import com.qualcomm.QCARSamples.ImageTargets.VuforiaTrackingActivity;
import com.my.package.MyProject.R;
public class MainActivity extends VuforiaTrackingActivity{
private File blenderFile;
#Override
protected synchronized void updateApplicationStatus(final int appStatus){
return;
}
#Override
protected GraphicsEngineHook getGraphicsEngineHook() {
return new MyGraphicsEngineHook();
}
#Override
protected int getSplashScreenImageResource() {
return R.drawable.splash_screen_image_targets;
}
}
I also tried including the activity I'm subclassing in my manifest like so, but I was still getting the same error:
<activity>
<android:name="com.qualcomm.QCARSamples.ImageTargets.VuforiaTrackingActivity>
</activity>
Any ideas?
The problem is usually on the BuildPath.
Assuming you're using eclipse and ADT:
Right click on your project, select Build Path -> Configure Build Path -> Order and Export and make sure that your library is selected.
Remember to clean the project before trying again.
it could also be the class path as the guy suggested on the commented, on the manifest, instead of editing direct the XML, go to the Application tab, select the activity, click Browser, uncheck 'Display classes from sources of Project ...', and select the Activity from your library.
I've done the setup as described for ActionBarSherlock. I've also added ABS as a library project and believe this is working as expected as Eclipse is finding references to class's within it's packages. I've also set the theme as required in the code and in the AndroidManifest.xml:
Code:
import com.actionbarsherlock.app.SherlockActivity;
public class TestClass extends SherlockActivity{
Context myContext;
public void onCreate(Bundle savedInstanceState) {
setTheme(R.style.Theme_Sherlock_NoActionBar);
super.onCreate(savedInstanceState);
setContentView(R.layout.test);
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.danieljgmaclean.xxx"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/px_icon"
android:label="#string/app_name"
android:theme="#style/Theme.Sherlock.Light" >
<activity
android:name="TestClass"
android:label="#string/app_name"
android:noHistory="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
However apon execution i'm getting the following exception thrown:
Caused by: java.lang.RuntimeException: Couldn't find content container view
This is being called on:
com.danieljgmaclean.xxx.TestClass.onCreate(TestClass.java:23)
I'm running the code on a 2.3.3 emulator and i've set the target build to 4.0.3 and JDK version to 1.6.
Any ideas would be appreciated.
In my case the problem was a "raw" folder inside res which contained the db of the app. So I just removed the folder and the actionbar worked again. Now the problem is that I need the raw...
I have a very simple application that works but when i add roboguice it throws
java.lang.RuntimeException: Unable to instantiate application
com.MyFirstApp.MyFirstApplication: java.lang.ClassNotFoundException:
com.MyFirstApp.MyFirstApplication
The application class:
public class MyFirstApplication extends RoboApplication {
#Override
protected void addApplicationModules(List<Module> modules) {
//modules.add(new DefaultModule());
}
}
The MainActivity:
public class MainActivity extends RoboActivity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
the manifest:
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.MyFirstApp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:name="MyFirstApplication">
<activity
android:name="com.MyFirstApp.Activities.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>
I have put guice-2.0-no_aop.jar and roboguice-1.1.3.jar in the assets folder and added them to the buildpath.
when i remove the robo part it works fine. can anyone tell me what i did wrong.
Well i found out what the problem was. i was using SDK v17+ and in that version external library's need te be placed in a "libs" folder and only in the libs folder. so all the tutorial's i found where they just put it in the assets folder where wrong.
Link to where i got the answer i was looking for: http://groups.google.com/group/roboguice/browse_thread/thread/474116b052050ae2
First of all, extending from RoboApplication is a RoboGuice 1.x thing, you should really be using RoboGuice 2.0 (where you no longer need to do that). Now, for your exception, is your Application class really at com.MyFirstApp.MyApplication? If not, you would need to update the name attribute to match.