OSM Android dependecies failed to resolve - android

I'm currently trying to implement OSMDroid in to my project, but doing it has shown in the OSMDroid tutorial (http://osmdroid.github.io/osmdroid/index.html) does not seem to be working.
When I try to sync the Gradle project I get the following message:
Failed to resolve: osmdroid-android
And I have here the full build.gradle(Module: app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.massas.emergency_numbers_pi"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'org.osmdroid:osmdroid-android:6.0.0-SNAPSHOT'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Am I doing something wrong or is the dependencie just outdated? Should I insert the dependencies in the project build.gradle?
I'm new to android dev, so please bear with me! Thanks

1) Make sure you have added the repository. You need maven central for stable releases and sonatype for snapshot. Instructions for that are included in the documentation but for the sake of this response:
Current stable:
repositories {
mavenCentral()
}
dependencies {
implementation 'org.osmdroid:osmdroid-android:6.0.1'
}
Current snapshot:
repositories {
mavenCentral()
maven{
url 'https://oss.sonatype.org/content/repositories/snapshots/'
name 'OSS-Sonatype'
}
}
dependencies {
implementation 'org.osmdroid:osmdroid-android:6.0.2-SNAPSHOT'
}
Note: you can also add repositories to your root gradle file to the allprojects section.
2) You should use the stable version (6.0.1 at the time of writing) uless you have a specific reason to use snapshot.

Related

Failed to resolve: com.onesignal:onesignal:3.12.3 on Native Android

I'm trying to setup one signal sdk to my native android application but failing with error:
"ERROR: Failed to resolve: com.onesignal:onesignal:3.12.3"
Tried some solutions from other related questions (most of the solutions are for old versions) and one signal website's troubleshoot section, nothing worked.
My gradle file
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.4, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
repositories {
maven { url 'https://maven.google.com' }
}
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.tiringbring.roomdbtest"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [
onesignal_app_id: 'tttttttt-25e9-tttt-tttt-77dc29ce5a08',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: 'REMOTE'
]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation "androidx.room:room-runtime:2.2.0-beta01"
annotationProcessor "androidx.room:room-compiler:2.2.0-beta01"
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.onesignal:onesignal:3.12.3'
}
Changing from 0.12.4 to 0.13.4 worked for me:
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.13.4, 0.99.99]'
Seems like there was an spelling error in the documentation of One Signal as
Anzy ShQ commented. Using 'com.onesignal:OneSignal:3.12.3' worked.

android studio can't resolve DaoMaster after import GreenDao

below are project build.gradle and app build.gradle files
//project build.gradle
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
}
}
//app build.gradle
apply plugin: 'org.greenrobot.greendao' // apply plugin
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.flover.greendaodemo"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha5'
testImplementation 'junit:junit:4.13-beta-3'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'org.greenrobot:greendao:3.2.2'
}
When using DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(this, "notes-db", null),show me error, can't resolve DaoMaster.
What wrong with that?
I'm a bit late to the party but you need to have at least one #Entity class in order for GreenDao to be able to generate classes like DaoMaster and DaoSession.
So, simply create a class annotated with #Entity and the properties you need and click Build -> Make Build in AndroidStudio or Build -> Clean Build in IntelliJ. You can also click on the Gradle tab on the right side of AndroidStudio OR IntelliJ, look for the GreenDao Gradle task and run that.

How to correctly apply the google services plugin?

I am working on a project, and I need to apply the google services plugin to my code. I have done so in the build.gradle project and module, but I keep receiving the following warning every time I run my app.
Please apply google-services plugin at the bottom of the build file.
Any help would be great!
Also, I am a beginner to coding, and it may be important to note that my app doesn't work. I get a runtime error in the emulator when I try to run it:
________ keeps stopping
app info
close app
Here is my build.gradle Module:app
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "edmt.dev.androidgeofire"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation
('com.android.support.test.espresso:espresso-core:3.0.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.h6ah4i.android.widget.verticalseekbar:verticalseekbar:0.7.2'
implementation 'com.firebase:geofire-android:2.3.1'
implementation 'com.google.firebase:firebase-database:16.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.google.android.gms:play-services-base:16.1.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
}
apply plugin: 'com.google.gms.google-services'
I'm not sure what else I would need to include to help anyone understand, so if anyone needs anything else I would be happy to add it.
Try changing your build.gradle(project) like this
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
}
}
Don't forget to change
classpath 'com.android.tools.build:gradle:3.3.2'
to your actual classpath of gradle

Unable to resolve dependency in latest android studio. Why and what is the issue in latest android studio

Unable to resolve dependency for ':app#release/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0-rc01
I know solution but I want know what is the main issue in latest android studio and why???
just changing the dependencies problem is fix as shown in below: Friends my question is why and what is the issue in latest android studio any another solution for this issue ...please help me out
Build : Gradle project
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Build : Gradle Module
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.myXYZ.MyApp"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
By your version of gradle plugin I assume you are using not the latest Android studio, but 3.1.x.
Try to use 3.2.5 beta from Canary (Beta) channel. It might help

Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.android.support:design:26.1.0

I am getting this error while sync gradle project.
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve com.android.support:design:26.1.0
can anyone help me?
apply plugin: 'com.android.application' android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.phaniteja.sample1"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
} } dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' }
Unable to resolve dependency for :app#debugAndroidTest/compileClasspath': Could not resolve com.android.support:design:26.1.0 This issue usually happens when the Android Studio is not able to download that dependency.That can be due to many reasons like this Or like in my case where the Maven2 and jcenter repositories are blocked in Company. So what can you do is like check this folder
Android-sdk\extras\android\m2repository\com\android\support\appcompat-v7
and check which all versions are available to you in the SDK, use either one of those versions ,So instead of downloading from repository studio will take that lib from SDK.
Try to add your Google maven repo. it works for me.##
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}

Categories

Resources