У меня было самое сложное время, чтобы просто запустить API Карт Google в Android Studio.Мне удалось пройти через большинство ошибок, кроме этой.
Последний бит, который идет в конце:
Command: C:\Users\fdher\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\5d744ebf759552512dd49d47a67bee49\aapt2-3.2.0-4818971-windows\aapt2.exe link -I\
C:\Users\fdher\AppData\Local\Android\Sdk\platforms\android-28\android.jar\
--manifest\
C:\Users\fdher\AndroidStudioProjects\FUSARTOURLIFE2\app\build\intermediates\split-apk\debug\resources\AndroidManifest.xml\
-o\
C:\Users\fdher\AndroidStudioProjects\FUSARTOURLIFE2\app\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
-R\
@C:\Users\fdher\AndroidStudioProjects\FUSARTOURLIFE2\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
--auto-add-overlay\
--java\
C:\Users\fdher\AndroidStudioProjects\FUSARTOURLIFE2\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
--custom-package\
com.example.fdher.fusartourlife\
-0\
apk\
--preferred-density\
420dpi\
--output-text-symbols\
C:\Users\fdher\AndroidStudioProjects\FUSARTOURLIFE2\app\build\intermediates\symbols\debug\R.txt\
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #0
Так выглядит мой файл манифеста
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.fdher.fusartourlife">
<user-permission android:name = "android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<user-permission android:name =
"android.permission.ACCESS_COARSE_LOCATION"/>
<user_permission android:name = "android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCFkMk9O7iiPVtrMorVPUTptkv8KCGsPgs"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MapActivity" />
</application>
</manifest>
В манифесте есть две идентичные ошибки для .MapActivity и .MainActivity
Я только начал использовать Android Studio, поэтому еслиЯ пропустил что-то явно очевидное, будь добр.Заранее спасибо!
РЕДАКТИРОВАТЬ: Добавлены оба файла build.gradle
app build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.fdher.fusartourlife"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-
layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.2'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
}
И один вне приложения FUSTOURLIFE build.gradle
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
// NOTE: Do not place your application dependencies here; they
// belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Этомой файл string.xml
<resources>
<string
name="google_maps_API_key">API_KEY</string>
<string name="app_name">FUSARTOURLIFE</string>
</resources>
Это мой файл colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>
Это файл styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
РЕДАКТИРОВАТЬ: ОТВЕТ-----------------------------------
Добавьте строку ниже в AndroidManifest.xml.
<uses-library android:name="org.apache.http.legacy" android:required="false" />
Работает как шарм.