+ Start a Discussion
Richard Evans 9Richard Evans 9 

Salesforce Mobile SDK 3.0 - Creating new Android hybrid_local - 115 errors after import

Hi,

I have followed the steps on how to setup and install a hybrid local application on android from the 'Mobile SDK Development Guide - Salesforce Mobile SDK 3.0' documentation. However I keep hitting the same error.

After importing the relavant projects into Eclipse, as stated by in the forcedroid output, there are 115 errors. I noticed the cordova reference was invalid in the SalesforceSDK project, pointing to '..\..\external\cordova\framework'. I change this to point to the CordovaApp-CordovaLib project in Eclipse, and after rebuilding the errors were gone.

However whenever I run the application I then get the following error:
 
12-14 22:42:34.313: E/AndroidRuntime(17385): FATAL EXCEPTION: main
12-14 22:42:34.313: E/AndroidRuntime(17385): Process: com.testapp.mytestapp, PID: 17385
12-14 22:42:34.313: E/AndroidRuntime(17385): java.lang.RuntimeException: Unable to instantiate application com.salesforce.androidsdk.smartsync.app.HybridAppWithSmartSync: java.lang.ClassNotFoundException: Didn't find class "com.salesforce.androidsdk.smartsync.app.HybridAppWithSmartSync" on path: DexPathList[[zip file "/data/app/com.testapp.mytestapp-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
12-14 22:42:34.313: E/AndroidRuntime(17385):     at android.app.LoadedApk.makeApplication(LoadedApk.java:563)
12-14 22:42:34.313: E/AndroidRuntime(17385):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4491)
12-14 22:42:34.313: E/AndroidRuntime(17385):     at android.app.ActivityThread.access$1500(ActivityThread.java:144)
12-14 22:42:34.313: E/AndroidRuntime(17385):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339)
12-14 22:42:34.313: E/AndroidRuntime(17385):     at android.os.Handler.dispatchMessage(Handler.java:102)
12-14 22:42:34.313: E/AndroidRuntime(17385):     at android.os.Looper.loop(Looper.java:135)
12-14 22:42:34.313: E/AndroidRuntime(17385):     at android.app.ActivityThread.main(ActivityThread.java:5221)
12-14 22:42:34.313: E/AndroidRuntime(17385):     at java.lang.reflect.Method.invoke(Native Method)
12-14 22:42:34.313: E/AndroidRuntime(17385):     at java.lang.reflect.Method.invoke(Method.java:372)
12-14 22:42:34.313: E/AndroidRuntime(17385):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
12-14 22:42:34.313: E/AndroidRuntime(17385):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
12-14 22:42:34.313: E/AndroidRuntime(17385): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.salesforce.androidsdk.smartsync.app.HybridAppWithSmartSync" on path: DexPathList[[zip file "/data/app/com.testapp.mytestapp-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
12-14 22:42:34.313: E/AndroidRuntime(17385):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
12-14 22:42:34.313: E/AndroidRuntime(17385):     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
12-14 22:42:34.313: E/AndroidRuntime(17385):     at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
12-14 22:42:34.313: E/AndroidRuntime(17385):     at android.app.Instrumentation.newApplication(Instrumentation.java:979)
12-14 22:42:34.313: E/AndroidRuntime(17385):     at android.app.LoadedApk.makeApplication(LoadedApk.java:558)
12-14 22:42:34.313: E/AndroidRuntime(17385):     ... 10 more
12-14 22:42:34.313: E/AndroidRuntime(17385):     Suppressed: java.lang.ClassNotFoundException: com.salesforce.androidsdk.smartsync.app.HybridAppWithSmartSync
12-14 22:42:34.313: E/AndroidRuntime(17385):         at java.lang.Class.classForName(Native Method)
12-14 22:42:34.313: E/AndroidRuntime(17385):         at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
12-14 22:42:34.313: E/AndroidRuntime(17385):         at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
12-14 22:42:34.313: E/AndroidRuntime(17385):         at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
12-14 22:42:34.313: E/AndroidRuntime(17385):         ... 13 more
12-14 22:42:34.313: E/AndroidRuntime(17385):     Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

I use the Eclipse ADT Bundle.
Version of Java is 1.8 (I have tried with 1.6 also)
Target API was 19
forcedroid version is 3.0.1

I suspect that the real issue will be something to do with the invalid project reference, as I wouldn't expect any errors after runing a fresh create and import like this.

Any help would be greatly appreciated.
Richard Evans 9Richard Evans 9
Forgot to mention operating system was Windows 8.1

Also, I Tried this on OSX and it worked fine.
akhilesh_sfdcakhilesh_sfdc
Richard, can you please open an issue on https://github.com/forcedotcom/SalesforceMobileSDK-Android ?

We will investigate this as soon as possible and post a fix. Thanks for reporting the issue.
dfatdfat
I believe I ran in to the same issue, and found it was caused by importing the directory named 'android' that is found within 'platform'. You should be importing the directory that is named after to your app name (two levels back from the 'android' specific directory). Once I did that, I was able to import the correct libs and plugins, and run the app in a simulator. If you are doing it incorrectly, you will only be prompted to import the Cordova lib along with your project (you should be asked for SalesforceSDK and SmartStore also). 

The documenation is a bit confusing since page 44 states:
"4. Expand the Android directory and choose Existing Android Code into Workspace."

I guess I took the 'Android directory' part too literally.