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.
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.
I am using android studio, when am trying to add dependency
compile 'com.loopj.android:android-async-http:1.4.9'
and sync the project am getting an error
Error:Failed to find: com.loopj.android:android-async-http:1.4.9
Open FileOpen in Project Structure dialog
when i open the project structure -> Dependency its showing under the library
But the problem is that the library is not syncing.
when i try to clean the project am getting error like
Error:A problem occurred configuring root project 'Frendy'.
Could not resolve all dependencies for configuration ':_debugCompile'.
Could not find com.loopj.android:android-async-http:1.4.9.
Searched in the following locations:
file:/C:/Users/Binil/AppData/Local/Android/sdk/extras/android/m2repository/com/loopj/android/android-async-http/1.4.9/android-async-http-1.4.9.pom
file:/C:/Users/Binil/AppData/Local/Android/sdk/extras/android/m2repository/com/loopj/android/android-async-http/1.4.9/android-async-http-1.4.9.jar
file:/C:/Users/Binil/AppData/Local/Android/sdk/extras/google/m2repository/com/loopj/android/android-async-http/1.4.9/android-async-http-1.4.9.pom
file:/C:/Users/Binil/AppData/Local/Android/sdk/extras/google/m2repository/com/loopj/android/android-async-http/1.4.9/android-async-http-1.4.9.jar
Required by:
:Frendy:unspecified
Can any one please help me.
Add Maven Repositories it should work, its described at https://github.com/loopj/android-async-http in gradle section
this is example of my gradle :
apply plugin: 'com.android.application'
repositories {
maven {
url 'https://repo1.maven.org/maven2/'
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.mine.android"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
} }
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.loopj.android:android-async-http:1.4.9'
}
}
Just add below code in build.gradle
repositories {mavenCentral()maven {url"https://oss.onatype.org/content/repositories/snapshots/" } }
I'm trying to implement the MVVM architecture using Robobinding. Here's the link I'm following for the Environment setup of Robobinding in Android Studio(without AspectJ):
http://robobinding.github.io/RoboBinding/getting_started.html#_android_studio
This is what my app level Build.gradle looks like after adding the dependencies:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.simpletimerapp"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile "org.robobinding:robobinding:${robobindingVersion}"
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.+'
}
}
The problem is gradle build fails with the following error:
Error:(26, 0) Could not find property 'robobindingVersion' on org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated#2ccd2d42.
Open File
EDIT 1:
On replacing ${robobindingVersion} in the dependencies block with 0.8.12 (latest version of robobinding), gradle build finishes successfully. But now, I'm unable to use the "bind" attribute in the views in my layout files. This is the error:
Unexpected namespace prefix "bind" found for tag TextView
EDIT 2:
Still can't find the solution. So, I downloaded this minimal android app (from their official github page) which implements robobinding and edited it to create my own app. It's working fine now.
I did a new install of Android Studio 1.0.2. Getting the following error when opening my first existing android project:
Gradle 'MyApplication' project refresh failed
Error:Artifact 'support-v4.jar (com.android.support:support-v4:21.0.3)' not found.
Searched in the following locations: file:/C:/Users/Ntokozo/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/support-v4/21.0.3/support-v4-21.0.3.jar
And if I navigate to that searched location I found two jar files which are: support-v4-21.0.3-sources.jar and support-v4-21.0.3-javadoc.jar
Here is my build.gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Gradle file under App folder:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.ntokozo.myapplication"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
}
Thank you in advance, please bare in mind in responses that I'm a novice and I might not know advanced features.
After re-installing windows OS and a new Android Studio setup the problem disappeared. I don't know what was the problem at first.
I'm getting these errors when trying to use an external library imported (as a Maven file dependency) through the Project Structure > Dependencies window in Android Studio 1.0 RC 2:
W/dalvikvm﹕ Unable to resolve superclass of Lcom/melnykov/fab/FloatingActionButton$1; (1487)
W/dalvikvm﹕ Link of class 'Lcom/melnykov/fab/FloatingActionButton$1;' failed
My build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "user.appname"
minSdkVersion 18
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.2'
compile 'com.android.support:recyclerview-v7:21.0.2'
compile 'com.android.support:cardview-v7:21.0.2'
compile 'com.melnykov:floatingactionbutton:1.1.0'
}
I've googled around and most solutions are for projects in Eclipse, involving setting the Java Build Path to Order and Export, but I can't seem to find a similar setting in Android Studio.
Thanks!
Given that you added
repositories {
mavenCentral()
}
to your build.gradle, I think that your issue is caused by gradle not being able to reach external resources.
Are you behind a proxy?
I solved this problem adding file gradle.properties in my home .gradle directory. It's made like this:
systemProp.http.proxyHost=myproxy.mydomain.it
systemProp.http.proxyPort=myproxyport
systemProp.http.proxyUser=myproxyuser
systemProp.http.proxyPassword=XXXXXXXX
systemProp.https.proxyHost=myproxy.mydomain.it
systemProp.https.proxyPort=myproxyport
systemProp.https.proxyUser=myproxyuser
systemProp.https.proxyPassword=XXXXXXXX
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost