Reputation: 138
I have been having the most difficult time to simply run the Google Maps API in Android Studio. I have managed to navigate through most of the errors except this one.
This last bit that comes at the end is
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
This is what my manifest file looks like
<?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>
The manifest has two identical errors that are for .MapActivity and .MainActivity
I have just started using Android Studio so if I missed something blatantly obvious please be kind. Thank you in advance!
EDIT: Added both build.gradle files
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'
}
And the one outside of the app 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
}
This is my string.xml file
<resources>
<string
name="google_maps_API_key">API_KEY</string>
<string name="app_name">FUSARTOURLIFE</string>
</resources>
This is my colors.xml file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>
This is the styles.xml file
<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>
EDIT: ANSWER------------------------------------
Add the below line in AndroidManifest.xml.
<uses-library android:name="org.apache.http.legacy" android:required="false" />
Works like a charm.
Upvotes: 2
Views: 1585
Reputation: 7531
The style Theme.AppCompat.Light.DarkActionBar and the missing colors are from AppCompat library. Add the dependency on it in your build.gradle:
implementation 'com.android.support:appcompat-v7:28.0.0'
Make sure the version of the library matches your compile SDK value.
Upvotes: 1
Reputation: 725
For initial setup and see how to configure google maps, start android studio and select Google Maps activity which will do all these configurations automatically.
Upvotes: 0