Gradle 'AppName' project refresh failed Cause: hostname in certificate didn't match - android

Gradle 'AppName' project refresh failed
Error:Cause: hostname in certificate didn't match: <jcenter.bintray.com> != <*.services-exchange.com> OR <*.services-exchange.com> OR <services-exchange.com>
1.I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this.
2.First ,I want change the version of the package(the 'appacompat-v7' and 'design'),then I change it to 25.0.3,the IDE give me a tip,next I change the targetSdkVersion to 25 and compileSdkVersion. The gradle didn't work.
3.
dependencies {
classpath 'com.android.tools.build:gradle:2.10'
4.
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "AppName"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
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:appacompat-v7:23.0.3'
compile 'com.android.support.design:design:23.0.3'
compile 'com.squareup.oktppp3:okhttp:3.10.0'
complie 'com.google.code.gson:gson:2.7'
complie 'com.android.recycleview-v7:23.0.3'
complie 'com.github.bumptech.glide:3.7.0'
complie 'com.wdullaer:masterladateimepicker:2.5.0'
}
How can I repair it?

You have a typo error. You should use this and change compile to implementation if you're using Android 3.0 and higher
compileSdkVersion 23
targetSdkVersion 23
Your applicationId should reflect your package name. Confirm this from your manifest.
Use 23.1.1 for dependencies
implementation 'com.android.support:appcompat-v7:23.1.1'
And this
classpath 'com.android.tools.build:gradle:3.1.3'

Related

Failed to resolve: com.android.support:appcompat-v7:22.0.0:

Error:
Failed to resolve: com.android.support:appcompat-v7:22.0.0:
How do I solve this error?
Config:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.ummat.qmduain"
minSdkVersion 11
targetSdkVersion 23
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')
compile files('libs/hvjavacal.jar')
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.google.android.gms:play-services-ads:7.8.0'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
}
Screenshot:
You are trying to compile version 22, but your compile SDK version is 23.
Solution:
'com.android.support:appcompat-v7:23.4.0'
You have a mismatch in your compile sdkVersion and support library version. You should use 23.0.0 or a newer version in 23.
On a side note, you are on a very old library versions. I would recommend bump up to 27 unless you have some other requirement.

Failed to resolve: com.android.support:appcompat-v7:21.0.1

I recently changed my mindSdkVersion to 17 and targetSdkVersion to 21, and got lots of errors. I fixed some of them, but I can't fix this one:
Error:(28, 13) Failed to resolve: com.android.support:appcompat-v7:21.0.1
I'm using Android Studio on Mac and I have Android Support repositories.
My build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.swit.sedamaker"
minSdkVersion 17
targetSdkVersion 21
versionCode 2
versionName "1.01"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile 'com.android.support:appcompat-v7:21.0.1'
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
}
The error occur because 21.0.1 for support libraries doesn't exist.
dependencies{
//it requires compileSdkVersion 21
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.2'
compile 'com.android.support:appcompat-v7:21.0.0'
}
You're better to match the API version for compileSdkVersion, buildToolsVersion, targetSdkVersion. Try to use the latest SDK
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
...
minSdkVersion 17
targetSdkVersion 24
...
}
...
}
dependencies {
compile 'com.android.support:appcompat-v7:24.2.0'
...
}
Of course you can set targetSdkVersion to 21 if you want. targetSdkVersion is used to inform the system that you have test the app against the target version like the documentation said.
android:targetSdkVersion
An integer designating the API Level that the
application targets. If not set, the default value equals that given
to minSdkVersion. This attribute informs the system that you have
tested against the target version and the system should not enable any
compatibility behaviors to maintain your app's forward-compatibility
with the target version. The application is still able to run on older
versions (down to minSdkVersion).
Read more at What is the difference between compileSdkVersion and targetSdkVersion? forcompileSdkVersion and targetSdkVersion.
Try Replace with:
implementation 'com.android.support:appcompat-v7:23.3.0'

Android Studio prevent build API23, I want only API22

How can I stop building for API23? I have many libraries, reduced probably all to API22 from API23. Still I have problems, when want to sync my gradle, it is showing errors in V23 styles.
Is there a way to disable building V23? I don't want to use API23. Don't tell me to update my project to API23 because in my app, permission checking is not necessary. It's inside company app (not for Google Play) and permission dialogs are not necessary.
This is error
Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Here is my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "com.pongodev.layartancepapp"
minSdkVersion 16
targetSdkVersion 22
versionCode 2
versionName "2.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:recyclerview-v7:22.1.0'
compile('com.mikepenz:materialdrawer:4.4.6#aar') {
transitive = true
}
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services:7.3.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
testCompile 'junit:junit:4.12'
compile 'com.mcxiaoke.volley:library:1.0.0'
compile 'com.github.mrengineer13:snackbar:1.0.0'
compile 'com.marshalchen.ultimaterecyclerview:library:0.3.18'
compile 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE'
compile 'com.mikepenz:google-material-typeface:2.2.0.3.original#aar'
compile 'com.github.AndroidDeveloperLB:MaterialPreferenceLibrary:1'
}
You can define compileSdkVersion and buildToolsVersion to 22 in build.gradle
compileSdkVersion = 'Google Inc.:Google APIs:22'
buildToolsVersion = "22.0.0"
These steps works for you:
1.Click build.gradle
2.Change compileSdkVersion 23 to 22
3.Change targetSdkVersion 23 to 22
follow pics
See Picture for clear understanding

Cannot resolve symbols in Android Studio and the code is okay

I know that this question was asked here a few times, but everything i have tried from answers they gave there didn't work for me.
Also i need to mention that i have tried File - Invilidate Cache and Restart and it didn't work..
Here is my build gradle(Maybe something there is wrong):
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.dusandimitrijevic.geomondo"
minSdkVersion 19
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:22.2.0'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.github.manuelpeinado.fadingactionbar:fadingactionbar:3.1.2'
}
I see three issues.
Your targetSdkVersion is higher than your compileSdkVersion.
You are using a version of the support library that requires a minimum of API 22 to compile with.
You are not specifying the version of recyclerview, so it will import the latest one, which requires API 23 to compile with.
The fix is to set compileSdkVersion to 23. That SHOULD fix your missing symbols issue.

Gradle build error."minsdkversion 14 cannot be different than version l declared in library"?

Hi everyone I am new to android developing.I download the latest version of android studio 1.3.2 yesterday.But when I start a new project for testing, gradle give me an error.
My gradle is
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.niyamat.testing3"
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.+'
}
The error is
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be different than version L declared in library [com.android.support:appcompat-v7:21.0.0-rc1] C:\Users\Niyamat\Documents\Testing3\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0-rc1\AndroidManifest.xml
I know there are some question about the same error but I didn't find any good solution.
So please someone help me?
Whats your Logcat Throws
Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be different than version L declared in library [com.android.support:appcompat-v7:21.0.0-rc1]
What should you Do
Remove minSdkVersion version from Manifest .You already declare it in your build.gradle .
Use this compileSdkVersion 21
buildToolsVersion '21.1.2' instead yours.
Compile compile 'com.android.support:appcompat-v7:21.0.1'
First of all remove this line from your Manifest .
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="22" />
Finally
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.niyamat.testing3"
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.1'
}
It is your issue.
uses-sdk:minSdkVersion 15 cannot be different than version L declared in library [com.android.support:appcompat-v7:21.0.0-rc1]
It is quite strange that you have in your sdk folder the preview version of appcompat 21.
This version was published with the lollipop preview (api-L) and had the minSdk = L. It is the reason of your issue (because you have minSdkVersion 15)
You should not have this folder in your sdk. Check with the SDK Manager if it is updated.
Then you can modify your build.gradle removing the +.
Support libraries v21
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.android.support:appcompat-v7:21.0.2'
compile 'com.android.support:appcompat-v7:21.0.3'
Support libraries v22 (require compileSdkVersion 22)
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:appcompat-v7:22.1.0'
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:appcompat-v7:22.2.1'
Support libraries v23 (require compileSdkVersion 23)
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.1'
Seems you have a previous version of the app compat into your lib folder specific for android L.
Also you should set the version for compileSdkVersion, buildToolVersion, targetSdkVersion and the appcompat-v7 to be the same.
In your case, the buildToolVersion should be "21.1.2".
Basically, this is the reason why android studio complains / suggests NOT using .+ in your compiles.
compile 'com.android.support:appcompat-v7:21.+'
It forces compile with absolute last version of appcompat 21 which is com.android.support:appcompat-v7:21.0.0-rc1 (as you can see from error you got). That version does not allow minSdkVersion 15 - it's made for Lollipop. Change your compile appcompat to version number that does allow minSdkVersion 15 to solve the issue.

Categories

Resources