我使用的是百度地图( SDK版本:4.5.2 ),但他们没有显示地图。相反,只显示网格线。
代码:
robocopy $f $g /MIR
public class MainApp extends MultiDexApplication {
@Override
public void onCreate() {
super.onCreate();
SDKInitializer.initialize(this);
}
}
class :(此代码在Kotlin中。如果您需要Java等效的代码,请在下面发表评论。)
BaiduMapActivity
build.gradle文件:
class BaiduMapActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_baidu_map)
}
override fun onResume() {
super.onResume()
bmapView.onResume()
}
}
日志:
buildscript {
ext.kotlinVersion = '1.2.10'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
//noinspection GradleDynamicVersion
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'io.fabric'
//For green dao
apply plugin: 'org.greenrobot.greendao'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
jcenter()
}
android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.0'
}
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.emerson.oversight"
minSdkVersion 16
targetSdkVersion 27
versionCode 6
versionName "1.6.2"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dataBinding {
enabled = true
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
disable 'MissingTranslation'
}
buildTypes {
release {
lintOptions {
disable 'MissingTranslation'
}
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
kapt { generateStubs = true }
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
transitive = true
}
//AppCompat v7 support library
compile 'com.android.support:appcompat-v7:27.0.2'
//AppCompat v4 support library
compile 'com.android.support:support-v4:27.0.2'
//Support design
compile 'com.android.support:design:27.0.2'
//Google Maps
compile 'com.google.android.gms:play-services-maps:11.8.0'
//Retrofit - for making REST API calls
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
//For Runtime permissions
compile 'com.karumi:dexter:4.2.0'
//To set custom fonts
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
//Attaches bullets to viewpager
compile 'com.robohorse.pagerbullet:pagerbullet:1.0.8'
//Expandable recycler view
compile 'com.bignerdranch.android:expandablerecyclerview:3.0.0-RC1'
//For Graph
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
//Date time
compile 'com.wdullaer:materialdatetimepicker:3.2.1'
compile 'com.android.support:recyclerview-v7:27.0.2'
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support:support-annotations:27.0.2'
androidTestCompile 'com.android.support.test:runner:1.0.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.android.support:gridlayout-v7:27.0.2'
compile 'com.android.support:cardview-v7:27.0.2'
compile 'jp.wasabeef:recyclerview-animators:2.2.6'
// compile 'com.ncornette.cache:okcache-control:1.1.1'
compile 'org.greenrobot:greendao:3.2.2'
compile 'net.danlew:android.joda:2.9.9'
compile 'com.github.barteksc:android-pdf-viewer:3.0.0-beta.3'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'org.jetbrains.anko:anko-common:0.8.3'
compile 'me.dm7.barcodescanner:zbar:1.9.8'
compile 'io.reactivex:rxjava:1.2.0'
compile 'com.squareup:android-times-square:1.6.5@aar'
// notice that the compiler version must be the same than our gradle version
kapt 'com.android.databinding:compiler:3.2.0-alpha05'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
}
}
apply plugin: 'kotlin-android-extensions'
图书馆结构:
结果如下。应用程序运行正常,但只显示网格线并且地图不可见。
可能的原因是什么?
答案 0 :(得分:0)
可能有几种选择:
答案 1 :(得分:0)
尝试使用中国VPN,然后查看地图是否已加载