Failed to add play-services to android studio - android

I want to do a practice project that i can find my location by google map. at first i installed google play service lib :
second, I add FINE permission and mate tag on manifest :
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<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">
<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>
</application>
third, I have added this lib on build.gradle:
compile 'com.google.android.gms:play-services:11.0.1'
but when i am syncing project< i got this error:
Error:(29, 13) Failed to resolve: com.google.android.gms:play-services:11.0.1
and Avoid using bundled version of Google Play services SDK.
what can i do? what any dependency i need?

Implement separate lib of google play services, that is more efficient than using the whole package. Use only required lib.
https://developers.google.com/android/guides/setup

Related

Paypal android INSTALL_PARSE_FAILED_MANIFEST_MALFORMED

I am trying to implement paypal sandbox into my application, i've followed every steps from the https://developer.paypal.com/sdk/in-app/android/ , however after importing everything and when i am trying to start my application i get the following error:
Installation did not succeed.
The application could not be installed: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
List of apks:
[0] '/Users/xxx/Desktop/Work/shop_java/app/build/outputs/apk/debug/app-debug.apk'
Installation failed due to: 'INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl695433300.tmp/base.apk (at Binary XML file line #63): com.paypal.pyplcheckout.home.view.activities.PYPLInitiateCheckoutActivity: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present'
And i don't quite understand why it is,
my Android manifest is:
<?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.xxx">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:networkSecurityConfig="#xml/network_security_config"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:dataExtractionRules="#xml/data_extraction_rules">
<activity android:name=".ProductActivity"/>
<activity android:name=".promotion.PromotionItemActivity"
/>
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTask"
android:hardwareAccelerated="true"
tools:node="merge">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
However it fails, i tried to rebuild, tried to clean, invalidate caches, gradle runs ok, but when i try to run it says this, any solutions?
Try to update the Library in build.gradle now the last version is 0.6.1.
implementation 'com.paypal.checkout:android-sdk:0.6.1'

Android Studio 4.0.1, Gradle, and React Native: AndroidManifest.XML not found when it exists

INTRO
Greetings, all!
My Android Studio 4.0.1 project refused to build due to not being able to find an AndroidManifest.xml file that's in /main/ where it should be, according to the documentation. Mass replacing the occurrences of "api" with "implementation" or vice versa hasn't helped.
Thus, what other information do you want for clarification, and what should change to ensure this works?
Thankee!
MANIFEST FILE
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hornet">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:roundIcon="#mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
RUN ERRORS WITH DEBUG MODE ACTIVE
Moved to this Google Doc for being too long for this post!
https://docs.google.com/document/d/19OO-OIzFy6IXPEOAdvGZLgXNsW_1sfiZsLDs6H0Jjzs/edit?usp=sharing
Try to rebuild the project or modify project structure. It happens when something was wrong

Google Maps API Android build gradle parse failing with Google Services integration

So I am developing a map using Google Maps API for Android Studio. I can get a running build on my phone (Android 28.0) but it has no data on it, it's just a blank map. As soon as I start adding google services it gives me new errors.
ERROR: Failed to parse XML in C:\Users\Madzp\Desktop\MapsRedo\app\src\main\AndroidManifest.xml
ParseError at [row,col]:[11,5]
Message: expected start or end tag
Affected Modules: app
This directs me to my manifest which edits the <application> tag with
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:hardwareAccelerated ="true"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<uses-library
android:name="org.apache.http.legacy"
android:required="false"/>
</application>
How do I sort this parsing error as it always makes my project gradle sync fail?
Thanks,

Execution failed for task ':app:processDebugManifest' after Android Studio 2.2 update

Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute activity#com.facebook.FacebookActivity#theme value=(#android:style/Theme.Translucent.NoTitleBar) from AndroidManifest.xml:28:13-72
is also present at [com.facebook.android:facebook-android-sdk:4.16.0] AndroidManifest.xml:32:13-63 value=(#style/com_facebook_activity_theme)
Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:24:9-28:75 to override
Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.droid.bdapp.test">
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:name="com.test.app.app.AppBaseApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
<activity android:name="com.test.app.ui.activities.WelcomeActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.test.engine.reader.view.test5"
android:label="#string/app_name"
android:theme="#style/AppTheme"></activity>
<activity android:name="com.test.app.ui.activities.test1" />
<activity android:name="com.test.app.ui.activities.test2" />
<activity android:name="com.test.app.ui.activities.test3" />
<activity android:name="com.test.app.ui.activities.test4" />
</application>
</manifest>
It's not Android Studio 2.2 upgrade issue, it's FB SDK released yesterday.
For now a solution is to revert to previous FB SDK in build.gradle:
dependencies {
// ...
compile 'com.facebook.android:facebook-android-sdk:4.15.0'
}
This worked for me, will track the change log and bug list on FB support to see the proper solution.
I agree with the other answer, however, I would like to propose another solution.
Stick with the theme determined by Facebook by removing android:theme="#android:style/Theme.Translucent.NoTitleBar" and keep using compile 'com.facebook.android:facebook-android-sdk:4+'
Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.droid.bdapp.test">
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name" />
Facebook wants to handle the themes for the webdialog spinners as stated in the changelog
Better handling of themes for webdialog spinners
Ref: https://developers.facebook.com/docs/android/change-log-4.x#4_16_0
Add the compile dependency with the latest version of the Facebook SDK in the build.gradle file:
dependencies {
compile 'com.facebook.android:facebook-android-sdk:4.16.0' //Or 4.16.1
}
DeadObjectExceptions Bugs fixed .
Facebook has a new version released 27Sep16.
https://developers.facebook.com/docs/android/downloads/
Most build.gradle files automatically pick up the latest version (as per install instructions). It seems 4.16.0 has a problem for a number of users. To force use of previous version until this is resolved, edit your build gradle to use the previous version.
compile ('com.facebook.android:facebook-android-sdk:4.15.0')
I'd expect this to be resolved by Facebook shortly and you can revert your build.gradle to pick up the latest version once more.

Android multi-process application

I have been wondering 1 thing about running multi-process app on Android.
Say, I have a setup in the manifest file as follow..
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.multiprocess">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".MainService"
android:process=":main" />
<service
android:name=".SubService"
android:process=":sub" />
</application>
</manifest>
With this, when I start both services with startService() and I will see each process listing separately on system's "Running services" page. (See image below)
I would like to know how can I get both processes list under 1 name like Google Play services does? (see image below)
Probably, they use android:sharedUserId for all of their processes. But in any case you can figured that out by extracting AndroidManifest.xml from Google Play *.apk file and analyze it

Categories

Resources