【问题标题】:Adding map library to android studio将地图库添加到android studio
【发布时间】:2019-02-01 23:15:30
【问题描述】:

我想将新库添加到我的 android 项目中,我添加了这个:

repositories {       
    maven { url "https://dl.bintray.com/neshan/neshan-android-sdk" }
}

还有这个:

dependencies {
    implementation 'neshan-android-sdk:mobile-sdk:0.9.1'
} 

但是sync gradle后出现错误:

Error:(32, 13) Failed to resolve: neshan-android-sdk:mobile-sdk:0.9.1

(我的 targetSdkVersion 是 25)

有人知道怎么解决吗?

【问题讨论】:

  • 你在哪里添加了 maven 存储库?哪个文件?
  • @Mostafa 您是否按照链接中给出的所有步骤进行操作。您注册到developers.neshan.org
  • 我将 maven 存储库添加到 build.gradel 项目级别
  • 是的,我在网站上注册了

标签: android maps neshan neshan-android-sdk


【解决方案1】:

检查依赖,它应该包含

group_name:artifactory_name:version_name

【讨论】:

    【解决方案2】:

    项目级别build.gradle

    allprojects {
        repositories {
            jcenter()
            google()
            maven { url "https://dl.bintray.com/neshan/neshan-android-sdk" }
        }
    }
    

    应用build.gradle

    dependencies {
        //Neshan sdk library
        implementation 'neshan-android-sdk:mobile-sdk:0.9.5'
    }
    

    【讨论】:

      【解决方案3】:

      您的库版本旧且已从存储库中删除, 你应该使用更新版本的库 见Neshan Map Document

      NeshanMobileSDK 的当前版本是 0.9.5

      【讨论】:

        【解决方案4】:

        请记住,在build.gradle (Project: ***) 中,repositories 有两个区域。一个在buildscript 下,另一个在allprojects 下,你应该把maven 仓库放在allprojects 区域。你的build.gradle (Project: ***) 应该如下所示:

        // Top-level build file where you can add configuration options common to all sub-projects/modules.
        
        buildscript {
            repositories {
                google()
                jcenter()
                // Putting maven URL here, will be useless! Please scroll down 
            }
            dependencies {
                classpath 'com.android.tools.build:gradle:3.5.1'
                // NOTE: Do not place your application dependencies here; they belong
                // in the individual module build.gradle files
            }
        }
        
        allprojects {
            repositories {
                google()
                jcenter()
                // Right place for repository URL
                maven {
                    url  "https://dl.bintray.com/neshan/neshan-android-sdk"
                }
            }
        }
        
        task clean(type: Delete) {
            delete rootProject.buildDir
        }
        

        为了确保其他一切都准备就绪,请将您的 build.gradle (module:app) 与我的进行比较:

        apply plugin: 'com.android.application'
        
        android {
            compileSdkVersion 28
            defaultConfig {
                applicationId "com.myapp.my"
                minSdkVersion 17
                targetSdkVersion 28
                versionCode 1
                versionName "1.0"
                testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
                vectorDrawables.useSupportLibrary = true
            }
            buildTypes {
                release {
                    minifyEnabled false
                    proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
                }
            }
            splits {
                abi {
                    enable true
                    reset()
                    include 'armeabi-v7a'
                    universalApk false
                }
            }
        }
        
        dependencies {
            implementation fileTree(dir: 'libs', include: ['*.jar'])
            implementation 'androidx.appcompat:appcompat:1.1.0'
            implementation 'com.android.support:design:28.0.0'
            implementation 'com.android.support:support-v4:28.0.0'
            implementation 'com.google.android.material:material:1.1.0-beta01'
            implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
            implementation 'androidx.navigation:navigation-fragment:2.1.0'
            implementation 'androidx.navigation:navigation-ui:2.1.0'
            implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
            implementation 'androidx.legacy:legacy-support-v4:1.0.0'
            implementation 'androidx.recyclerview:recyclerview:1.0.0'
            testImplementation 'junit:junit:4.12'
            androidTestImplementation 'androidx.test:runner:1.2.0'
            androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
            implementation 'com.google.android.gms:play-services-maps:17.0.0'
            //Neshan sdk library
            implementation 'neshan-android-sdk:mobile-sdk:0.9.5'
        }
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2018-02-12
          • 1970-01-01
          • 2017-01-17
          • 1970-01-01
          • 1970-01-01
          • 2018-11-27
          • 1970-01-01
          相关资源
          最近更新 更多