+ Start a Discussion
Aatmaprem AaryaAatmaprem Aarya 

SalesforceMobileSDK-Android 3.2 , forcedroid template app does not work + Cant import either in eclipse or android studio.

Environment : Windows 8.1 , Java 7  , Eclipse June , Android Studio 1.2

1. Template project compiles and installs but crashes on launch with stack trace.

E/AndroidRuntime( 6604): FATAL EXCEPTION: main
E/AndroidRuntime( 6604): Process: com.test.hybrid, PID: 6604
E/AndroidRuntime( 6604): java.lang.RuntimeException: Unable to instantiate application com.salesforce.androidsdk.smartsync.app.HybridAppWithSmartSync: java.lang.ClassNotFoundException: Didn't find cla
ss "com.salesforce.androidsdk.smartsync.app.HybridAppWithSmartSync" on path: DexPathList[[zip file "/data/app/com.test.hybrid-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
E/AndroidRuntime( 6604):        at android.app.LoadedApk.makeApplication(LoadedApk.java:563)
E/AndroidRuntime( 6604):        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4526)
E/AndroidRuntime( 6604):        at android.app.ActivityThread.access$1500(ActivityThread.java:151)
E/AndroidRuntime( 6604):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
E/AndroidRuntime( 6604):        at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 6604):        at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime( 6604):        at android.app.ActivityThread.main(ActivityThread.java:5254)
E/AndroidRuntime( 6604):        at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 6604):        at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 6604):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
E/AndroidRuntime( 6604):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
E/AndroidRuntime( 6604): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.salesforce.androidsdk.smartsync.app.HybridAppWithSmartSync" on path: DexPathList[[zip file "/data/app/com.t
est.hybrid-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
E/AndroidRuntime( 6604):        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
E/AndroidRuntime( 6604):        at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
E/AndroidRuntime( 6604):        at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
E/AndroidRuntime( 6604):        at android.app.Instrumentation.newApplication(Instrumentation.java:980)
E/AndroidRuntime( 6604):        at android.app.LoadedApk.makeApplication(LoadedApk.java:558)
E/AndroidRuntime( 6604):        ... 10 more
E/AndroidRuntime( 6604):        Suppressed: java.lang.ClassNotFoundException: com.salesforce.androidsdk.smartsync.app.HybridAppWithSmartSync
E/AndroidRuntime( 6604):                at java.lang.Class.classForName(Native Method)
E/AndroidRuntime( 6604):                at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
E/AndroidRuntime( 6604):                at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
E/AndroidRuntime( 6604):                at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
E/AndroidRuntime( 6604):                ... 13 more
E/AndroidRuntime( 6604):        Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
W/ActivityManager(  746):   Force finishing activity 1 com.test.hybrid/com.salesforce.androidsdk.ui.sfhybrid.SalesforceDroidGapActivity

2. Project on imported to eclipse follwing the command after template creation:
a. The cordova project is not detected as a project/lib.
b. Created other peoject and added source from cordova and added the dependency , still doesnt work.

3. Android studio , imported the project and marked the android as main project.
No launch target detected , says not gradle backed.

Help.
Vivek DVivek D
Hi,

I faced the same issue using forcedroid it does not create the main app. The best way would be to download the SDK and use the existing template and modify it based on your requirement. For example there is an app callled UserList in hybrid app section use that.