I want to use the Android-pdfview library to show a pdf file within my application. I already compiled the library sucessfully, but when I want to Display the pdf following logcat Errors appear:
java.lang.UnsatisfiedLinkError: Couldn't load vudroid from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/de.gestureanywhere-1.apk"],nativeLibraryDirectories=[/data/app-lib/de.gestureanywhere-1, /vendor/lib, /system/lib]]]: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:358)
at java.lang.System.loadLibrary(System.java:526)
at de.gestureanywhere.Changelog_View.onCreate(Changelog_View.java:60)
at android.app.Activity.performCreate(Activity.java:5241)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2151)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2236)
at android.app.ActivityThread.access$800(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1199)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5034)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
at dalvik.system.NativeStart.main(Native Method)
I have read a couple of hours and found out, that I have to compile the libvudroid.so or have to compile the armeabi library.
But all the how to, which I have read before, won't work.
So can you provide me please a step by step solution how to compile the library?
My gradle file Looks like this right now:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
compileOptions.encoding = 'ISO-8859-1'
defaultConfig {
applicationId "de.gestureanywhere"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile ( 'proguard-android.txt' ), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree ( include: '*.jar', dir: 'libs' )
compile 'com.android.support:appcompat-v7:22.0.0'
compile files ( 'libs/android-pdfview-1.0.3.jar' )
}
Thanks a lot for helping.
The jar file does not contain the native libraries required for the pdfview library to work.
Instead of
compile files ( 'libs/android-pdfview-1.0.3.jar' )
use
compile 'com.joanzapata.pdfview:android-pdfview:1.0.4#aar'
to load the AAR package dependency which contains the java and native library.
Related
I am trying to do some experiments with Instant Apps Documentation: Android Instant Apps
Native Android apps, without the installation. I have followed steps which are covered on official docs. I have created emulator Nexus 5X to test instant apps features.
So, I have created two features in my project, which is much similar just kinda of demo to see how instant apps works. It was working well on one feature, now after when I created one more feature, now I have two features which in turns crashing my application.
05-24 12:07:12.259 12020-12028/? E/art: Failed writing handshake bytes (-1 of 14): Broken pipe
05-24 12:07:15.952 12020-12020/com.williams.instantappdemo E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.williams.instantappdemo, PID: 12020
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.williams.instantappdemo/com.williams.instantappdemo.feature.MainActivity}: java.lang.ClassNotFoundException: could not find com.williams.instantappdemo.feature.MainActivity in any atom class loader or parent class loader
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2567)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.ClassNotFoundException: could not find com.williams.instantappdemo.feature.MainActivity in any atom class loader or parent class loader
at com.google.android.instantapps.supervisor.loader.WhAppClassLoader.loadClass(WhAppClassLoader.java:100)
at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2557)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Suppressed: java.lang.ClassNotFoundException: Didn't find class "com.williams.instantappdemo.feature.MainActivity" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/system/lib, /vendor/lib, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.google.android.instantapps.supervisor.loader.WhAppClassLoader.loadClass(WhAppClassLoader.java:85)
... 11 more
Suppressed: java.lang.ClassNotFoundException: Didn't find class "com.williams.instantappdemo.feature.MainActivity" on path: DexPathList[[zip file "/data/user/0/com.google.android.instantapps.supervisor/files/atom-cache/com.williams.instantappdemo/atom-download--base-1495607829279/base.jar"],nativeLibraryDirectories=[/data/user/0/com.google.android.instantapps.supervisor/files/native-lib/com.williams.instantappdemo, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at com.google.android.instantapps.supervisor.loader.DexFirstClassLoader.doLoadClass(DexFirstClassLoader.java:50)
at com.google.android.instantapps.supervisor.loader.WhAppClassLoader.loadClass(WhAppClassLoader.java:92)
... 11 more
Suppressed: java.lang.ClassNotFoundException: Didn't find class "com.williams.instantappdemo.feature.MainActivity" on path: DexPathList[[zip file "/data/user/0/com.google.android.instantapps.supervisor/files/atom-cache/com.williams.instantappdemo/atom-download--feature-1495607829279/feature.jar"],nativeLibraryDirectories=[/data/user/0/com.google.android.instantapps.supervisor/files/native-lib/com.williams.instantappdemo, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at com.google.android.instantapps.supervisor.loader.DexFirstClassLoader.doLoadClass(DexFirstClassLoader.java:50)
at com.google.android.instantapps.supervisor.loader.WhAppClassLoader.loadClass(WhAppClassLoader.java:92)
... 11 more
Here is build.gradle of feature module:
apply plugin: 'com.android.feature'
android {
compileSdkVersion 25
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
minSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation project(':base')
testCompile 'junit:junit:4.12'
}
Here is build.gradle for feature2:
apply plugin: 'com.android.feature'
android {
compileSdkVersion 25
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
minSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation project(':base')
testCompile 'junit:junit:4.12'
}
Here is the build.gradle for base module:
apply plugin: 'com.android.feature'
android {
compileSdkVersion 25
buildToolsVersion rootProject.buildToolsVersion
baseFeature true
defaultConfig {
minSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
feature project(':feature')
compile 'com.android.support:appcompat-v7:25.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
feature project(":feature1")
}
Here is the build.gradle of app module:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
applicationId "com.nagarro.instantappdemo"
minSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation project(':feature')
implementation project(':feature1')
implementation project(':base')
}
Can anyone suggest what I am doing wrong ?
It looks like the actual activity package doesn't match what you have in your manifest file of the feature that contains MainActivity. It's a common error when refactoring activities into new packages and not using relative paths for activities in the manifest. Fully qualify the path to be absolutely sure
<activity android:name="com.williams.instantappdemo.feature.MainActivity"/>
Inspect the the apk file (build/outputs/apks) using Apk Analyzer to see if it has com.williams.instantappdemo.feature.MainActivity in that exact package.
You can also use the Merged Manifest view to inspect your final manifest (app module) to verify everything is in order.
Also, add application project(":app") to the base feature module so that it uses applicationId defined in your app module to package your app/instant app
Update:
Using the techniques described above, I investigated the merged manifests and found an issue. The build plugin ignored the numbers in the module name (feature1) so both features ended up having the same name. This caused a bunch of issues including the ActivityNotFound error. Renaming the feature1 module to featureOne resolved the issue.
We're looking to implement our AWS API Gateway generated Android SDK in our app.
When we try to build our client class, we get the following error:
java.lang.NoClassDefFoundError: Failed resolution of:Lcom/amazonaws/util/json/DateDeserializer;
Here's how we create our client instance:
ApiClientFactory factory = new ApiClientFactory();
final CigarSocialClient client = factory.build(CigarSocialClient.class);
We have been searching for a solution but haven't found anything yet. The best solution seems to ditch the generated sdk and invoke our api gateway via web requests.
Any help is appreciated!
UPDATE:
We're using the following aws tutorial
Here is our build.gradle file for the app
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '24.0.1'
defaultConfig {
applicationId "com.example"
minSdkVersion 14
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile fileTree(include: ['*.jar'], dir: 'app/libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:design:24.2.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.amazonaws:aws-android-sdk-core:2.2.+'
compile 'com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.2.+'
}
And here is the stack trace:
D/Error: ERR: stack=java.lang.NoClassDefFoundError: Failed resolution of: Lcom/amazonaws/util/json/DateDeserializer;
at com.amazonaws.mobileconnectors.apigateway.ApiClientHandler.(ApiClientHandler.java:59)
at com.amazonaws.mobileconnectors.apigateway.ApiClientFactory.getHandler(ApiClientFactory.java:145)
at com.amazonaws.mobileconnectors.apigateway.ApiClientFactory.build(ApiClientFactory.java:123)
at com.example.API.testApiGatwaySdk(API.java:125)
at com.example.ListFragment$override.onCreateView(ListFragment.java:60)
at com.example.ListFragment$override.access$dispatch(ListFragment.java)
at com.example.ListFragment.onCreateView(ListFragment.java:0)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2080)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1108)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1290)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1272)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2149)
at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:201)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:600)
at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1256)
at android.app.Activity.performStart(Activity.java:6929)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2910)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3008)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4974)
at android.app.ActivityThread.-wrap21(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6688)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.amazonaws.util.json.DateDeserializer" on path: DexPathList[[dex file "/data/data/com.example/files/instant-run/dex/slice-support-annotations-24.2.0_f4e9ad562a860d98fa5881a52f2737573a46b23e-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-internal_impl-24.2.0_d08c5958e93c18231cddf69dc14d83b8ae6d3fa3-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-internal_impl-24.2.0_ce51fbf88aa3b5412a363fc449e8164899b38118-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-internal_impl-24.2.0_982f26845e74cf0a28b29b365
You are using a version of aws-android-sdk-core that is very old and not compatible with the altest clients generated by API gateway. Please update the sdk to the latest.
I have used facebook sdk for log in with facebook and also google map for user current position. It run well in android 5.o or above but crashes in android 4.4.3. I have used following configuration.
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.example.nuevo.getsocial"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions{
javaMaxHeapSize "4g"
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile project(path: ':volley')
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.squareup.picasso:picasso:`enter code here`2.4.0'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.android.support:design:24.2.0'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
}
Logcat is as follow
446/com.example.nuevo.getsocial E/dalvikvm: Could not find class
'com.google.firebase.FirebaseOptions', referenced from method
com.google.firebase.FirebaseApp. 08-29 02:41:35.041
1446-1446/com.example.nuevo.getsocial E/dalvikvm: Could not find class
'com.google.firebase.FirebaseApp$zzb', referenced from method
com.google.firebase.FirebaseApp.zzcm 08-29 02:41:35.045
1446-1446/com.example.nuevo.getsocial E/dalvikvm: Could not find class
'com.google.firebase.FirebaseApiNotAvailableException', referenced
from method com.google.firebase.FirebaseApp.getToken 08-29
02:41:35.049 1446-1446/com.example.nuevo.getsocial E/dalvikvm: Could
not find class 'com.google.firebase.FirebaseApp$zza', referenced from
method com.google.firebase.FirebaseApp.zza 08-29 02:41:35.081
1446-1446/com.example.nuevo.getsocial E/AndroidRuntime: FATAL
EXCEPTION: main Process: com.example.nuevo.getsocial, PID: 1446
java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions at
com.google.firebase.FirebaseApp.zzek(Unknown Source) at
com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown
Source) at
android.content.ContentProvider.attachInfo(ContentProvider.java:1591)
at
android.content.ContentProvider.attachInfo(ContentProvider.java:1562)
at
com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown
Source) at
android.app.ActivityThread.installProvider(ActivityThread.java:4774)
at
android.app.ActivityThread.installContentProviders(ActivityThread.java:4369)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4309)
at android.app.ActivityThread.access$1500(ActivityThread.java:135) at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:102) at
android.os.Looper.loop(Looper.java:136) at
android.app.ActivityThread.main(ActivityThread.java:5001) at
java.lang.reflect.Method.invokeNative(Native Method) at
java.lang.reflect.Method.invoke(Method.java:515) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at
dalvik.system.NativeStart.main(Native Method)
replace your appcompat and design libraries into gradle dependencies with following
compile 'com.android.support:appcompat-v7:24.0.0-alpha1'
compile 'com.android.support:design:24.0.0-alpha1'
According to Android Studio User Guide:Multidex support prior to Android 5.0
Versions of the platform prior to Android 5.0 (API level 21) use the Dalvik runtime for executing app code. By default, Dalvik limits apps to a single classes.dex bytecode file per APK. In order to get around this limitation, you can use the multidex support library, which becomes part of the primary DEX file of your app and then manages access to the additional DEX files and the code they contain.
In your case, if you're supporting old version of Android, you need to include com.android.support:multidex:1.0.0 in your gradle dependency.
I upgraded my android studio's version and now I am using version 2.1.3, which I believe is the current version. The com.android.support:appcompat-v7 too has been upgraded to 24.2.0.
Everything works fine except for the navigation back arrow which keeps giving an error,
this is the error
08-22 18:04:59.470 11403-11403/com.app.oues E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.app.oues, PID: 11403
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app.oues/com.app.oues.Registration}: android.content.res.Resources$NotFoundException: File res/drawable/abc_ic_ab_back_material.xml from drawable resource ID #0x7f020014
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/abc_ic_ab_back_material.xml from drawable resource ID #0x7f020014
at android.content.res.Resources.loadDrawable(Resources.java:2101)
at android.content.res.Resources.getDrawable(Resources.java:700)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:346)
This is the code calling the arrow on the tool bar
final Drawable upArrow = ContextCompat.getDrawable(getApplicationContext(), R.drawable.abc_ic_ab_back_material);
getSupportActionBar().setHomeAsUpIndicator(upArrow);
This is my grade
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.app.oues"
minSdkVersion 9
targetSdkVersion 24
versionCode 2
versionName "1.0.1"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}}dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:design:24.2.0' }
After reading around it, I added vectorDrawables.useSupportLibrary = true to the gradle but it doesn't work, the error keeps popping up. I would be grateful if somebody could help. Thanks
I had problems with the version 24 appCompat libraries as well. In my stack trace, down lower than the NotFoundException, I had an XmlPullParserException with a cause of 'invalid drawable tag vector'. Although make sure you vector drawable XML file is just in your 'drawable' source folder. Also, I just used the (deprecated) getResources().getDrawable() call which seems to work. I also had tried your 'ContextCompat' call but it didn't change anything. My call is:
syncButton.setImageDrawable(getResources().getDrawable(R.drawable.ic_sync_timer_day));
This only seemed to affect API 19 devices (Did not test below that). It worked on API 22, 23 and 24 devices (Did not test 20 or 21).
My fix was to roll back to 'com.android.support:appcompat-v7:23.2.1' (and other associated V 23 stuff). Now tested OK in emulators for API 19, 22, 23, and 24.
It took some time to figure out how to support all the flavors, but this seemed to work.
My app Gradle.build file looks like the below, although I may have some things in there that are not actually needed, as I was trying everything from multiple posts (Made the mistake of changing more than one thing at a time I'm afraid).
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'RaceTac'
keyPassword 'clover99'
storeFile file('C:/Users/Dave/Documents/Dev/AndroidKeyStore.jks')
storePassword 'clover99'
}
}
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.hubbardsoftware.racetac"
minSdkVersion 16
targetSdkVersion 23
versionCode 14
versionName '1.05'
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
generatedDensities = []
}
// Needed for backward compatibility with Vector graphics
aaptOptions {
additionalParameters "--no-version-vectors"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
// compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.android.support:multidex:1.0.1'
}
Not sure this is a direct answer, but V 24 does seem to have some issues.
I am using Android studio with Epson Wikitude's SDK. When I run the application it crashes and I am getting an inflate class error. I have looked at several other questions, but none of the was quite the same or worked for my problem.
/com.example.username.myapplication E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering /
com.example.username.myapplication E / AndroidRuntime: FATAL EXCEPTION: main
Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: load_library[1091]: Library '/data/data/com.example.pmbi002.myapplication/libarchitect.so'
not found
at java.lang.Runtime.load(Runtime.java: 340)
at java.lang.System.load(System.java: 524)
at com.wikitude.architect.ArchitectView.e(Unknown Source)
at com.wikitude.architect.ArchitectView.a(Unknown Source)
at com.wikitude.architect.ArchitectView. < init > (Unknown Source)
at com.wikitude.architect.ArchitectView. < init > (Unknown Source)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java: 417)
at android.view.LayoutInflater.createView(LayoutInflater.java: 586)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java: 680)
at android.view.LayoutInflater.rInflate(LayoutInflater.java: 739)
at android.view.LayoutInflater.inflate(LayoutInflater.java: 489)
at android.view.LayoutInflater.inflate(LayoutInflater.java: 396)
at android.view.LayoutInflater.inflate(LayoutInflater.java: 352)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java: 280)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java: 140)
at com.example.pmbi002.myapplication.MainActivity.onCreate(MainActivity.java: 30)
at android.app.Activity.performCreate(Activity.java: 4465)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1049)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 1920)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 1981)
at android.app.ActivityThread.access$600(ActivityThread.java: 123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java: 1147)
at android.os.Handler.dispatchMessage(Handler.java: 99)
at android.os.Looper.loop(Looper.java: 137)
at android.app.ActivityThread.main(ActivityThread.java: 4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java: 511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java: 784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java: 551)
at dalvik.system.NativeStart.main(Native Method)
Build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 15
buildToolsVersion '22.0.0'
defaultConfig {
applicationId "com.example.myusername.myapplication"
minSdkVersion 11
targetSdkVersion 15
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v4:22.0.0'
compile 'com.android.support:design:22.0.0'
}
Android studio expects the native libraries to be at the lib folder inside the jar while they are in the libs folder so android studio can't find them.
What you can do to fix this is:
make a copy of the jar
unzip it extract the libs folder
rename libs to lib and zip the lib folder
rename the new .zip to .jar
and import it in your gradle file:
dependencies{
compile fileTree(dir: 'libs', include: '*.jar’)
}
This fixed it for me.
It was also described in the wikitude forum: http://www.wikitude.com/developer/developer-forum/-/message_boards/message/858620#_19_message_858823
Edit:
You can also try to
set classpath ‘com.android.tools.build:gradle:1.5.0’ to ‘com.android.tools.build:gradle:1.3.0’ in build.gradle from your project
make sure the compileSdkVersion, targetSdkVersion and com.android.support-v4 are 22 or lower
This should not be a problem because the Epson Moverio BT-200 runs on Android 15
Edit:
This gradle setup solved the problem for me:
/app/build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.wikitude.sdksamples"
minSdkVersion 9
targetSdkVersion 22
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:21.0.3'
compile fileTree(dir: 'libs', include: '*.jar')
}
project build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
allprojects {
repositories {
jcenter()
}
}
As i mentioned in the comments, there is an Wikitude Epson SDK update coming soon which should get rid of the complications with android studio.