Fix mapbox native library loading if app targets armeabi non-v7a

This commit is contained in:
Marvin W 2019-07-04 23:53:04 +02:00
parent 8a0010a1d8
commit dfb1e7fbb7
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A
2 changed files with 5 additions and 4 deletions

View File

@ -35,8 +35,7 @@ class MapFragmentImpl(private val activity: Activity) : IMapFragmentDelegate.Stu
private var map: GoogleMapImpl? = null
private var options: GoogleMapOptions? = null
override fun onInflate(activity: IObjectWrapper, options: GoogleMapOptions, savedInstanceState: Bundle) {
Log.d(TAG, "onInflate: ${options.camera.target}")
override fun onInflate(activity: IObjectWrapper, options: GoogleMapOptions, savedInstanceState: Bundle?) {
this.options = options
map?.options = options
}
@ -48,7 +47,6 @@ class MapFragmentImpl(private val activity: Activity) : IMapFragmentDelegate.Stu
if (options == null) {
options = GoogleMapOptions()
}
Log.d(TAG, "onCreate: ${options?.camera?.target}")
map = GoogleMapImpl(activity, options ?: GoogleMapOptions())
}

View File

@ -29,7 +29,10 @@ class MultiArchLoader(private val mapContext: Context, private val appContext: C
override fun load(name: String) {
try {
val otherAppInfo = mapContext.packageManager.getApplicationInfo(appContext.packageName, 0)
val primaryCpuAbi = ApplicationInfo::class.java.getField("primaryCpuAbi").get(otherAppInfo) as String?
var primaryCpuAbi = ApplicationInfo::class.java.getField("primaryCpuAbi").get(otherAppInfo) as String?
if (primaryCpuAbi == "armeabi") {
primaryCpuAbi = "armeabi-v7a"
}
if (primaryCpuAbi != null) {
val path = "lib/$primaryCpuAbi/lib$name.so"
val cacheFile = File("${appContext.cacheDir.absolutePath}/.gmscore/$path")