I'm new to Android Studio. I was developing a application in which I want to upload the documents to Evernote. I'm using Evernote SDK.
I was downloaded the Evernote Android SDK and sample app from Evernote site with the instructions given by Evernote. I was take a build of sample app and run via Android Studio then it will work correctly, but when I add the library as a module in my project and take the build it was successful.
When I'm running means the following error shows:
05-28 18:47:04.614: E/Parcel(968): Class not found when unmarshalling: com.evernote.client.android.EvernoteSession$EvernoteService
05-28 18:47:04.614: E/Parcel(968): java.lang.ClassNotFoundException: com.evernote.client.android.EvernoteSession$EvernoteService
05-28 18:47:04.614: E/Parcel(968): at java.lang.Class.classForName(Native Method)
05-28 18:47:04.614: E/Parcel(968): at java.lang.Class.forName(Class.java:251)
05-28 18:47:04.614: E/Parcel(968): at java.lang.Class.forName(Class.java:216)
05-28 18:47:04.614: E/Parcel(968): at android.os.Parcel.readParcelableCreator(Parcel.java:2133)
05-28 18:47:04.614: E/Parcel(968): at android.os.Parcel.readParcelable(Parcel.java:2097)
05-28 18:47:04.614: E/Parcel(968): at android.os.Parcel.readValue(Parcel.java:2013)
05-28 18:47:04.614: E/Parcel(968): at android.os.Parcel.readArrayMapInternal(Parcel.java:2314)
05-28 18:47:04.614: E/Parcel(968): at android.os.Bundle.unparcel(Bundle.java:249)
05-28 18:47:04.614: E/Parcel(968): at android.os.Bundle.getString(Bundle.java:1118)
05-28 18:47:04.614: E/Parcel(968): at android.content.Intent.getStringExtra(Intent.java:5285)
05-28 18:47:04.614: E/Parcel(968): at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:1586)
05-28 18:47:04.614: E/Parcel(968): at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:1167)
05-28 18:47:04.614: E/Parcel(968): at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:4496)
05-28 18:47:04.614: E/Parcel(968): at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:4378)
05-28 18:47:04.614: E/Parcel(968): at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:161)
05-28 18:47:04.614: E/Parcel(968): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3002)
05-28 18:47:04.614: E/Parcel(968): at android.os.Binder.execTransact(Binder.java:404)
05-28 18:47:04.614: E/Parcel(968): at dalvik.system.NativeStart.run(Native Method)
05-28 18:47:04.614: E/Parcel(968): Caused by: java.lang.NoClassDefFoundError: com/evernote/client/android/EvernoteSession$EvernoteService
05-28 18:47:04.614: E/Parcel(968): ... 18 more
05-28 18:47:04.614: E/Parcel(968): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.evernote.client.android.EvernoteSession$EvernoteService" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
05-28 18:47:04.614: E/Parcel(968): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
05-28 18:47:04.614: E/Parcel(968): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
05-28 18:47:04.614: E/Parcel(968): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
05-28 18:47:04.614: E/Parcel(968): ... 18 more
I was integrating the library in my project based on below points.
Include the Android Library Project in your Intellij workspace
- Right click your project and choose Open Module Properties
- Select the Plus Icon (Add) at the top and choose Import Module
- Select the library directory and click OK
- Click Next, Next, Next, Next
- Click Finish
- Click your project and select teh Dependencies tab
- Click the Plus Icon (Add) at the bottom and select 3 Module Dependency
- Select library and click OK
The following are the gradle files:
Build.gradle file for library project:inside the folder library apply plugin: 'com.android.library'
android {
compileSdkVersion 17
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 5
targetSdkVersion 16
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile files('libs/evernote-api-1.25.jar')
compile files('libs/scribe-1.3.1.jar')
}
build.gradle of my project : that is my project module apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "com.xerox.xeroxmobilelink.clouddemo"
minSdkVersion 16
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':library')
compile project(':accountsManager')
compile project(':cloudAccountsLogin')
compile project(':cloudFolderChooser')
compile project(':cloudDocumentUploader')
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
}
I was added activity of library in my module manifest file then it will work. The following are the statements in manifest file inside tag
<activity
android:name="com.evernote.client.android.EvernoteOAuthActivity"
android:configChanges="orientation|keyboardHidden"/>