0

I own Nexus 7 2013(4.4.3) which i used for testing Sample Code from google which are downloaded from LINK.

I have latest android SDK with Eclipse and USB Debugging enabled. I have tested created first app Hello World and it worked.

but for more training i am downloading samples but they are not working.Like i have downloaded 1.RepeatingAlarm 2.HorizontalPaging 3.SlidingTabsColors 4.FragmentTransition , but none of them are working.

Like i loaded the project from Import using eclipse and it gets loaded but things are not working while running. When the project is run first of all i get an exclamation mark on Target (4.4.3) since project is Google API (x86) Level 19 so from project properties i change it to 4.4.2 But still nothing works.

then i created AVD with Target as GoogleAPI (x86) but app fails again. Everything in my pocket is been used and i have no more tricks left to make them running. None of the samples run NONE.

I copied the LogCat errors.


06-18 10:03:59.826: D/AndroidRuntime(1933): Shutting down VM
06-18 10:03:59.826: W/dalvikvm(1933): threadid=1: thread exiting with uncaught exception (group=0xb0d38b20)
06-18 10:03:59.876: E/AndroidRuntime(1933): FATAL EXCEPTION: main
06-18 10:03:59.876: E/AndroidRuntime(1933): Process: com.example.android.horizontalpaging, PID: 1933
06-18 10:03:59.876: E/AndroidRuntime(1933): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.android.horizontalpaging/com.example.android.horizontalpaging.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.android.horizontalpaging.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.android.horizontalpaging-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.android.horizontalpaging-1, /vendor/lib, /system/lib]]
06-18 10:03:59.876: E/AndroidRuntime(1933):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
06-18 10:03:59.876: E/AndroidRuntime(1933):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
06-18 10:03:59.876: E/AndroidRuntime(1933):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
06-18 10:03:59.876: E/AndroidRuntime(1933):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
06-18 10:03:59.876: E/AndroidRuntime(1933):     at android.os.Handler.dispatchMessage(Handler.java:102)
06-18 10:03:59.876: E/AndroidRuntime(1933):     at android.os.Looper.loop(Looper.java:136)
06-18 10:03:59.876: E/AndroidRuntime(1933):     at android.app.ActivityThread.main(ActivityThread.java:5017)
06-18 10:03:59.876: E/AndroidRuntime(1933):     at java.lang.reflect.Method.invokeNative(Native Method)
06-18 10:03:59.876: E/AndroidRuntime(1933):     at java.lang.reflect.Method.invoke(Method.java:515)
06-18 10:03:59.876: E/AndroidRuntime(1933):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
06-18 10:03:59.876: E/AndroidRuntime(1933):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
06-18 10:03:59.876: E/AndroidRuntime(1933):     at dalvik.system.NativeStart.main(Native Method)
06-18 10:03:59.876: E/AndroidRuntime(1933): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.android.horizontalpaging.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.android.horizontalpaging-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.android.horizontalpaging-1, /vendor/lib, /system/lib]]
06-18 10:03:59.876: E/AndroidRuntime(1933):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
06-18 10:03:59.876: E/AndroidRuntime(1933):     at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
06-18 10:03:59.876: E/AndroidRuntime(1933):     at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
06-18 10:03:59.876: E/AndroidRuntime(1933):     at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
06-18 10:03:59.876: E/AndroidRuntime(1933):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
06-18 10:03:59.876: E/AndroidRuntime(1933):     ... 11 more

Please let me know if more information are required.

Also, from google example for FragmentTransition am not able to even run it. It gives error while compiling in fragment_detail_content.xml

like

android:textColor="#ffffff"

ffffff is not spelled correctly

on ImageView Missing contentDescription attribute drawable not spelled correctly

sam
  • 45
  • 1
  • 5
  • I'm not sure if the problem is that the apk has "-1" in the name, or the apk just isn't building at all. There is a connection between apk name and something in manifest. Check eclipse "Problem" tab. – hack_on Jun 18 '14 at 14:24
  • nothing in problem tab its blank – sam Jun 18 '14 at 14:32

2 Answers2

0

Update after downloading rar and re-producing the problem:

I made a few changes because the source in the project was in "java" dir not "src" dir. Then I downloaded the support jars and put them in a "lib" directory in the project, then right-clicked and "add to Build Path". Wrong. This compiled fine but produced the same error.

Then I removed them from the build path, right-clicked the project -> Android Tools -> Add Support Library ... and got version 19 of the support library. Then it built and this time it ran without crashing.

This idea came from this SO question

---------------------- Original answer -----------------------

Other things to try when eclipse is not being rational:

1) Clean the project and re-build it.
2) Stop and start eclipse.

Suggestions specific to your problem:

Set any min or target sdk back to what ever it was when you downloaded it. Maybe delete the project, re-download and don't touch anything -- not even the name of the project.

According to this post the problem may be to do with the version of Java that is running your eclipse. They had installed Java 1.7 instead of 1.6 and after installing Java 1.6 and changing JDK_ROOT to point to it, their problem was gone. Also check the compile settings for version of java, although this should be stock if you just downloaded the project.

This is what my project properties look like for one of my apps (building for 4.0+).

project properties

Several people are also mentioning the build path like this blogger who also had touble with an Android sample until finally, they solved it by correcting Java Build Path - right clicking project -> Java Build Path, select Order and Export tab, check to include both Android 4.2.2 and Android Private Libraries, and click OK

Community
  • 1
  • 1
hack_on
  • 2,532
  • 4
  • 26
  • 30
  • Nothing is working for me i do a clean install 3rd time with all defaults. Downloaded fresh sample's untouched. But same problem. I am running all latest softwares JDK , Eclipse , SDK with no pending updates. Still same error in logcat – sam Jun 19 '14 at 10:24
  • @sam, Have you checked that the java compiler compliance is 1.6? – hack_on Jun 19 '14 at 11:01
  • yes its exact what you have suggested. I am literally losing hope in android. I even clean installed JDK. Image and video hosting by TinyPic – sam Jun 19 '14 at 17:38
  • @sam, when you get the error now, do you still get /data/app/com.example.android.horizontalpaging-1.apk with the -1 or -2 on the end? I am suspicious that this is your problem and if its still there, try creating a new workspace in eclipse and import again. I think the bin directory should have com.example.android.horizontalpaging.apk in it. – hack_on Jun 19 '14 at 22:01
  • I created a fresh workspace downloaded the sample SlidingTabColors imported in eclipse. But the problem persists. I use windows 7 (64-bit) I have grabbed few screenshots to justify Dropbox links for folder | https://www.dropbox.com/sh/otssuco0aa5xbfq/AABfPFeFMonzqWhwMd_ulsSoa – sam Jun 20 '14 at 08:32
  • @sam I've used Windows 7 (64-bit) for three years to develop Android apps, and the main issue I had was permissions on one of the tools that were installed using an admin account. If you post the APK file to dropbox (in the bin directory of the project) I will try to see what is wrong with it. – hack_on Jun 25 '14 at 21:45
  • i have dropped the entire folder i.e. the project as MainActivity.rar which includes everything which was imported and placed in workspace. just mere 127kb file. If you do not wish to download it i have also dropped the .apk file from bin folder as suggested – sam Jun 26 '14 at 11:44
0
  1. Make sure all the system images and Google APIs are downloaded. If your MinSDKVersion is x, make sure you have API level x system images downloaded and installed. Check project-properties file to make sure your target there and targetSDKversion on Androidmanifest.xml are the same.
  2. When you create the AVD make sure the target ABI exactly matches the targetSDKVerision on your Manifest file.
  3. Make sure there are no errors or warnings after loading your application
  4. SDK and NDK path variables are set correctly
  5. Restart eclipse, clean and build project
G3M
  • 1,023
  • 8
  • 19
  • I am not sure why all API's and all versions of SDK build are required the latest will be backward compatible. Yes AVD matches exactly. There are no errors in some samples but others there are and i really cant figure out why.Yes NDK and SDK path are set correctly. Restart, clean install, downloading fresh samples did not helped. – sam Jun 23 '14 at 08:44