Разработка Android-приложений с Augmented Reality - страница 17
defaultConfig {
multiDexEnabled true
}
dependencies {
compile 'com.android.support: multidex:1.0.0»
}
android {
dexOptions {
javaMaxHeapSize «4g»
}
}
В файл манифеста добавим:
android:name="android.support.multidex.MultiDexApplication»> Добавим зависимость от библиотек beyondar-googlemap-plugin-v0.9.0.jar, beyondar-radar-plugin-v0.9.1.jar и beyondar-v0.9.3.jar, скопировав соответствующие файлы в папку libs проекта. Добавим зависимость от библиотеки Google Play Services. compile 'com.google.android.gms: play-services:9.6.1» Добавим необходимые разрешения в файл манифеста. Для использования Google Map добавим Google API Key в файл манифеста. Для того получим ключ в Google Developers Console и добавим в тег android:name="com.google.android.geo. API_KEY» android: value=«AIzaSyBcRu9Vvb7…» /> Изменим файл компоновки content_main. xml. xmlns: android="http://schemas.android.com/apk/res/android" xmlns: app="http://schemas.android.com/apk/res-auto" xmlns: tools="http://schemas.android.com/tools" android: layout_width=«match_parent» android: layout_height=«match_parent» android: paddingLeft="@dimen/activity_horizontal_margin» android: paddingRight="@dimen/activity_horizontal_margin» android: paddingTop="@dimen/activity_vertical_margin» android: paddingBottom="@dimen/activity_vertical_margin» android: fillViewport=«true» android: layout_gravity=«fill_vertical» app: layout_behavior="@string/appbar_scrolling_view_behavior» tools:context=".MainActivity» tools: showIn="@layout/app_bar_main» android: id="@+id/content_main» > android: layout_width=«match_parent» android: layout_height=«match_parent»> android: id="@+id/beyondarFragment» android:name="com.beyondar.android.fragment.BeyondarFragmentSupport» android: layout_width=«match_parent» android: layout_height=«match_parent» /> Изменим код класса главной активности. package com.tmsoftstudio.aryourworld; import android. app. Dialog; import android.content. DialogInterface; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android. os. Bundle;; import android.support.design. widget. FloatingActionButton; import android.support. v4.app. DialogFragment; import android.support.v4.widget.NestedScrollView;