2015-09-04 105 views
0

我試圖在Graphhopper示範項目工作在Android Studio中,我發現在這裏:https://github.com/graphhopper/graphhopper/tree/master/androidGraphhopper示範項目不會對Android的工作室工作

的搖籃建設後,我得到這個錯誤: 錯誤:無法解析:com.graphhopper:graphhopper:0.6-SNAPSHOT

現在Android Studio無法解析Graphhopper類的符號。

這裏是我的build.gradle:

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 19 
buildToolsVersion "21.1.2" 

defaultConfig { 
    applicationId "com.graphhopper.android" 
    minSdkVersion 10 
    targetSdkVersion 22 
} 

buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
    } 
} 

lintOptions { 
    /* CGIARProvider refers to java.awt 
    * Helper7 refers to java.lang.management 
    * HeightTile refers to javax.imageio and java.awt 
    * OSMElement refers to javax.xml.stream 
    */ 
    disable 'InvalidPackage' 
} 
} 

/** only necessary if you need to use latest SNAPSHOT 
configurations.all { 
// check for updates every build 
resolutionStrategy.cacheChangingModulesFor 0, 'seconds' 
} 
**/ 

dependencies { 
compile(group: 'com.graphhopper', name: 'graphhopper', version: '0.6-SNAPSHOT') { 
    exclude group: 'com.google.protobuf', module: 'protobuf-java' 
    exclude group: 'org.openstreetmap.osmosis', module: 'osmosis-osm-binary' 
    exclude group: 'org.apache.xmlgraphics', module: 'xmlgraphics-commons' 
} 

compile group: 'org.mapsforge', name: 'mapsforge-core', version: '0.5.2' 
compile group: 'org.mapsforge', name: 'mapsforge-map', version: '0.5.2' 
compile group: 'org.mapsforge', name: 'mapsforge-map-android', version: '0.5.2' 
compile group: 'org.mapsforge', name: 'mapsforge-map-reader', version: '0.5.2' 

compile group: 'org.slf4j', name: 'slf4j-android', version: '1.7.12' 
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.12' 

}

回答

2

這是因爲com.graphhopper:graphhopper:0.6-SNAPSHOT是不是在中央Maven(或jcenter)。

您可以檢查所有版本here

最後的穩定版本是0.5.0

如果你想使用你有snapshot versions添加repositoryin您build.gradle

repositories { 
    jcenter() 
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" } 
} 

這裏snapshot versions.

+0

另一種可能性是在本地構建幷包含未註釋的resolutionStrategy.cacheChangingModulesFor – Karussell