How to add linkedin sdk path in app gradle? - android-studio

I had followed so many tutorials to add linkedin sdk and sync gradle in my project but unable to did that. Downloaded linked sdk from https://developer.linkedin.com/downloads#androidsdk & unziped the folder then add the sdk file to my project directory. I mean copied that to project->app->lib path.Now i am getting the error while writing LISessionManager in activity.Something like this cannot resolve symbol 'LISessionManager'
Here is my build.gradle(app module) file,
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.interfinet.jobtree"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
apply plugin: 'android-apt'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:palette-v7:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.weiwangcn.betterspinner:library-material:1.1.0'
compile 'com.github.hotchemi:permissionsdispatcher:2.0.7'
apt 'com.github.hotchemi:permissionsdispatcher-processor:2.0.7'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.jaredrummler:material-spinner:1.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
}
Setting.gradle file is,
include ':app', ':linkedin-sdk'

You have to add linkedin-sdk folder as a module to your project:
and add this line to your app build.gradle dependencies:
compile project(':linkedin-sdk')

Related

isuess sync gradle for some old project from git

ERROR: Could not find com.android.tools.build:gradle:3.4.1. Searched
in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.4.1/gradle-3.4.1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.4.1/gradle-3.4.1.jar
Required by:
project : Add Google Maven repository and sync project Open File Enable embedded Maven repository and sync project
i have try to update distributionUrl
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
and this my build gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.example.android.miwok"
minSdkVersion 15
targetSdkVersion 29
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'
implementation "com.android.support:appcompat-v7:$supportVersion"
implementation "com.android.support:support-v4:$supportVersion"
implementation "com.android.support:design:$supportVersion"
}
well this is not best practice to do that, first of all, run that project in android studio and update the gradle, follow one method from this link Link.

Google API gradle errors when trying to compile code in Android Studio

I was following a guide on how to make an application similar to uber, I seem to have come across an issue not resolved by the guide. How do I get Android Studio to find the matching client for my package name? Also how do I go about updating the stated firebase build in the code?
I get a error that reads "org.gradle.api.GradleException: No matching client found for package name 'com.NovaTaxi.uber'"
The first solution I was able to find and test was changing the name of my file so that it didnt match the project name and that was of no help. Next I tried to download the completed version of the code to see if it would run for me, in an attempt to find what was wrong and replace it in my own work. To no avail it also wouldn't run because of the same error.
There is a lot of the code and I can't pin-point the error, so I will provide part of the error, and then a link to the vide/github so that you have a better scope of things.
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.NovaTaxi.uber"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.google.firebase:firebase-core:16.0.1'
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'
})
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-core:11.6.0'
compile 'com.google.firebase:firebase-database:11.6.0'
compile 'com.google.firebase:firebase-auth:11.6.0'
compile 'com.google.firebase:firebase-storage:11.6.0'
compile 'com.firebase:geofire-android:2.1.1'
compile 'com.google.android.gms:play-services:11.6.0'
compile 'com.github.bumptech.glide:glide:4.0.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.github.jd-alexander:library:1.1.0'
compile 'com.paypal.sdk:paypal-android-sdk:2.15.3'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
There should be no error but because of what I assume is an issue with the gradle compatibles it wont compile.

failed to resolve com.android.support.espresso:espresso-core:2.2.2

I've just downloaded android studio for the first time and i'm getting gradle errors. I've downloaded everything the SDK provided and still the same errors.
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.noelly.myapplication"
minSdkVersion 19
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'
})
compile 'com.android.support:appcompat-v7:25.+'
testCompile 'junit:junit:4.12'
}
The errors I'm getting are
(Failed to resolve: com.android.support.appcompat-v7:25.+)
and
(Failed to resolve: com.android.support.espresso:espresso-core:2.2.2)
Everything by the way is up to date,please help this is really frustrating starting out.
**EDIT FROM ANSWER ONE- PICTURE OF INSTALLED TOOLS---
sdktoolsscreenshot
Code form project build.gradle
// 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:2.2.3'
// 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
}
New Error messages_____newerrorscreenshot
failed to resolve com.android.support.espresso:espresso-core:2.2.2
This error can occur when we refactor layout name.
I had the same problem and my mistake was that I had created the layout naming test.xml and then when I refactored that name with like layout_offers.xml, my gradle was changed something like
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.detail_layout.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
})
Whereas It should be like follow
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'
})
So, one solution is that we should avoid using test.xml as a layout name.
Here's how your gradle file should look like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.noelly.myapplication"
minSdkVersion 19
targetSdkVersion 25
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:25.1.0'
}
Update:
There must be a problem with the SDK you downloaded. Navigate to C:/Users/Noelly/AppData/Local/Android/Sdk/extras/android/m2repository/com/android and delete the support folder.
Now open your SDK Manager and re-install the Android Support Repository.
I got same trouble as yours, and I have found how to solve the problem.
It was because I was using x86 operating system, while android studio was x64.
I went to https://developer.android.com/studio/index.html and pressed 'download option', and installed x86 version of android studio.
Do not uninstall your previous x64 android studio. It is required because of the android sdk.
unpack your x86 android studio anywhere, and find 'bin' folder. There should be your 'studio.exe'.
I got this same error message after renaming a layout file, although everything had just worked before. I fixed this by commenting out these lines from gradle:
androidTestCompile('com.android.support.detail_layout.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
I have no idea why this happened or if this is a good way of fixing it, only hoping that this could be a quick fix for some beginner like me.

Decompiling a self generated jar in lib in Android Studio

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.github.triplet.play'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.prototype"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
testCoverageEnabled = false
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
testCompile "org.mockito:mockito-core:1.10.19"
testCompile 'org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:0.31'
}
I have generated a jar using swagger codegen and have placed in lib folder of my app in the Android studio. It is not getting decompiled, i.e., I am not able to see classes of my jar here.
I have tried Invalidate caches/Restart. It worked sometimes before.
But it is not working anymore. Any help will be appreciated.
You probably missing in your build.gradle something like:
compile files('libs/your-jar-filename.jar')
The following worked for me :
Right-click the jar file.
Select 'Add as Library.
Do Gradle Sync.

java.util.zip.ZipException: duplicate entry: org/apache/http/ConnectionClosedException.class

I am getting error like this when i run the application.I am using HttpClient,HttpEntity,HttpResponse and HttpPost in my MainActivity..so i made some modifications to gradle file.After that i am getting error like this.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/http/ConnectionClosedException.class
i have also included multidex library and org.apache.http.legacy.jar in my app.but then also i am getting the same error.
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.test1"
minSdkVersion 15
targetSdkVersion 23
multiDexEnabled true
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 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:multidex:1.0.1'
compile files('libs/org.apache.http.legacy.jar')
compile 'org.apache.httpcomponents:httpmime:4.5.1'
}
I Know this question has been asked many times,but none of the solutions worked for me..
Can anyone please help me to resolve this one.
You may not use "compile 'org.apache.httpcomponents:httpcore:4.4.1'" nor "compile files('libs/org.apache.http.legacy.jar')" at the same time.
I too faced the same issue. The problem is Since you are using
compile files('libs/org.apache.http.legacy.jar') and
compile 'org.apache.httpcomponents:httpmime:4.5.1'
You need to remove the two libs which I mentioned below. Which contains duplication of the above.
if you are adding legacy and httpmime you don't need this
compile 'org.apache.httpcomponents:httpcore:4.4.1'//remove this
compile 'org.apache.httpcomponents:httpclient:4.5' // remove this too
Also add this inside android section in gradle
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
useLibrary 'org.apache.http.legacy'

Resources