VerifyError Exception on Android Studio - android-studio

I'm running my app on Android Studio 1.3.2, and getting an exception that I can't get through. I've been searching on google for hours and didn't find the solution.
java.lang.VerifyError: org/apache/http/conn/ssl/DefaultHostnameVerifier
at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:944)
at com.romi.expensemanager.OCRServiceAPI.sendImage(OCRServiceAPI.java:62)
at com.romi.expensemanager.OCRServiceAPI.convertToText(OCRServiceAPI.java:44)
at com.romi.expensemanager.Main$1.run(Main.java:68)
at java.lang.Thread.run(Thread.java:856)
I add external jars:
httpclient-4.5.jar, httpcore-4.4.1.jar, httpmime-4.5.jar.
My build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.romi.expensemanager"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile files('libs/achartengine-1.1.0.jar')
compile files('libs/picasso-2.5.2.jar')
compile project(':httpclient-4.5')
compile project(':httpcore-4.4.1')
compile project(':httpmime-4.5')
}
Any help will be appreciated. Thanks.

Related

Design view not getting displayed on Android Studio

I just imported a project, but when i try to enter design view this shows up:
My current gradle version is the latest 26.0.2 by the way. I'm not sure what to do, anyone have an idea?
Here are some Gradle Scripts:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion
defaultConfig {
applicationId "com.example.Ron.myapp"
minSdkVersion 15
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 'com.android.support:design:23.1.1'
}
and
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I solved the problem myself. I upgraded the compileSdkVersion aswell as the minSdkVersion along with the dependencies. It now looks like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion
defaultConfig {
applicationId "com.example.Ron.myapp"
minSdkVersion 18
targetSdkVersion 26
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:26.0.2'
compile 'com.android.support:design:26.0.2'
compile 'com.android.support:cardview-v7:26.0.2'
}
please update your support lib and compileSdkVersion like below.
compileSdkVersion = 25
buildToolsVersion = "25.0.2"
minSdkVersion = 18
// Library versions
supportLibraryVersion = "25.0.0"
also add ConstraintLauout gradle in gradle file.
compile 'com.android.support.constraint:constraint-layout:1.0.2'
For More details please check : https://stackoverflow.com/a/45115111/1343788
known problem
just add
compile 'com.android.support.constraint:constraint-layout:1.0.2'
in your gradle file,
it will fix it

How to compile a module as an AAR and include it in the project in one build?

I have an app module and a module that I'm using as a library -- I'm still making changes to the library, so it isn't precompiled. The library module has its own res folder, which I'd like to keep separate from the main app's res folder. I believe the only way to do this is to package the library as an aar before including it in the main app. It would be convenient if I could run a single Gradle build to package the library and include it. Is this possible?
gradle.build for app (which compiles "my-library"):
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.app.id"
minSdkVersion 18
targetSdkVersion 25
versionCode 5
versionName "1.4"
}
sourceSets {
main {
assets.srcDirs = [project.ext.ASSET_DIR]
}
}
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 project(':my-library')
}
gradle.build for my-library:
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
minSdkVersion 18
targetSdkVersion 25
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
It turns out that Android Studio is smart enough handle a library module with a res folder. My error was coming from a conflict in the Manifest files.

Cannot find <stdio.h> in android studio project

i am trying to run FM radio project in android sudio but it gives me error
(i downloaded this project from this git https://github.com/mikereidis/spirit2_free)
IMAGE : Android studio + Cannot find stdio.h
here is my gradle file settings
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.testFM"
minSdkVersion 16
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.4.0'
}
and here is the local.properties file where NDK path is declared
ndk.dir=C\:\\Users\\*****\\AppData\\Local\\Android\\sdk\\ndk-bundle
sdk.dir=C\:\\Users\\*****\\AppData\\Local\\Android\\sdk
Please help
Thanks
Try to run File->Invalidate Caches / Restart...

Gradle doesn't load 0.9.8 version library

apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.user.myapplication"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
java.srcDirs = ['src/main/java', 'src/main/java/2', 'src/main/java/com/example/user/myapplication/function']
}
}
}
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.github.PhilJay:MPAndroidChart:v2.2.4'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.androidplot:androidplot-core:0.9.8'
}
this is my code.
Gradle doesn't load 0.9.8 version library. However when I use 0.6.1 library it can load. I want to use latest version. What's the problem?
For anyone for whom updating did not work, when I had this problem I discovered that it was because I did not have
mavenCentral()
in the project level build.gradle file (under allprojects and repositories).

Error: com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/pubnub/api/AbstractLogger.class

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/pubnub/api/AbstractLogger.class
i am facing this error while building the gradle can anyone help me out.????
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "io.atlanticlab.pubnubmaptracker"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
}
dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.pubnub:pubnub-android-debug:3.7.10'
compile 'com.pubnub:pubnub-android:3.7.10'
}
repositories {
mavenCentral()
}

Resources