Android Question Cannot download play-services-common

ltrebuchet

Member
Licensed User
Longtime User
With Android SDK platform and tools 25 and Google Play Services 38 the extras library com\google\android\gms does not include play-services-common so using Barxdroid WearableDatalayer library I get error 'cannot access GoogleApiClient'
How can I download it?
Thanks for help
 

ltrebuchet

Member
Licensed User
Longtime User
This line is already in, and I could use NotificationBuilder library in my app.
#additionaljar: com.android.support:support-v4
#AdditionalJar: google-play-services.jar
#AdditionalJar: wearable-2.0.0-alpha3.jar
#AdditionalJar: play-services-10.0.1.aar
#AdditionalJar: play-services-wearable-10.0.1.aar
I really cannot add a play-service-common jar because this library is missing in the gms library.
The problem might come from the SDK, because i think that normally play-services-common should be included in com\google\android\gms, but it is not.
Thanks for your help
 
Upvote 0

ltrebuchet

Member
Licensed User
Longtime User
ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
Generating R file. (0.20s)
Compiling generated Java code. Error
B4A line: 671
DataLayer.Initialize(\
javac 1.8.0_112
src\louistrebuchet\golfcoach9\main.java:988: error: cannot access GoogleApiClient
mostCurrent._vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv7.Initialize(processBA,"Layer");
^
class file for com.google.android.gms.common.api.GoogleApiClient not found
 
Upvote 0

ltrebuchet

Member
Licensed User
Longtime User
I just updated Android studio this morning, then used the SDK trough it to download the last google play services (#38)
It comes with extras\google\m2repository\com\google\android\gms which includes a lot of libraries (play-service-ads up to play-services-wearable), each of them including an aar, aar.md5, aar.sha1, pom, pom.md5, pom.sha1. The first of them, play-services, include sevetral versions of play-services aar, the latest one being play-services-10.0.1.aar but no play-service-common, contrary to what android developer support announces.
I shall try with Firebase Analytics, but I have to sdk-download firebase first
 
Upvote 0

ltrebuchet

Member
Licensed User
Longtime User
I tried Firebase Analytics:
Recorded louistrebuchet.golfcoach10 (=Package)
Copied google-services.json in the same folder as GolfCoach Project 10.b4a
Code:
#additionaljar: com.android.support:support-v4
#AdditionalJar: wearable-2.0.0-alpha3.jar
#AdditionalJar: play-services-10.0.1.aar
#AdditionalJar: play-services-wearable-10.0.1.aar
Manifest:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="9" />
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
'************ Google Play Services Base ************
AddApplicationText(
<activity android:name="com.google.android.gms.common.api.GoogleApiActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:exported="false"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@Integer/google_play_services_version" />
)
'************ Google Play Services Base (end) ************
'************ Firebase Base ************
CreateResourceFromFile("google-services", "google-services.json")
AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.INTERNET)
AddPermission(android.permission.WAKE_LOCK)
AddPermission(com.google.android.c2dm.permission.RECEIVE)
AddPermission(${applicationId}.permission.C2D_MESSAGE)
AddManifestText( <permission android:name="${applicationId}.permission.C2D_MESSAGE"
android:protectionLevel="signature" />)
AddApplicationText(
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.measurement.UPLOAD"/>
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.measurement.AppMeasurementService"
android:enabled="true"
android:exported="false"/>
<provider
android:authorities="${applicationId}.firebaseinitprovider"
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:exported="false"
android:initOrder="100" />
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.measurement.UPLOAD"/>
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.measurement.AppMeasurementService"
android:enabled="true"
android:exported="false"/>
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
android:exported="false" />
<service
android:name="com.google.firebase.iid.FirebaseInstanceIdService"
android:exported="true">
<intent-filter android:priority="-500">
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
)
'************ Firebase Base (end) ************
'************ Firebase Notifications ************
AddApplicationText(
<service
android:name="com.google.firebase.messaging.FirebaseMessagingService"
android:exported="true">
<intent-filter android:priority="-500">
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="anywheresoftware.b4a.objects.FirebaseNotificationsService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
)
'************ Firebase Notifications (end)************
'************ Firebase Analytics ************
AddApplicationText(
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.measurement.UPLOAD"/>
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.measurement.AppMeasurementService"
android:enabled="true"
android:exported="false"/>
<service android:name="com.google.firebase.crash.internal.service.FirebaseCrashReceiverService"
android:process=":background_crash"/>

<service android:name="com.google.firebase.crash.internal.service.FirebaseCrashSenderService"
android:process=":background_crash"/>
)
'************ Firebase Analytics (end) ************
Error:
B4A version: 6.31
Parsing code. (0.17s)
Compiling code. (0.89s)
ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code. (0.02s)
Organizing libraries. (0.46s)
Generating R file. Error
AndroidManifest.xml:32: error: Error: No resource found that matches the given name (at 'value' with value '@Integer/google_play_services_version').

Many thanks for your help, Louis
 
Upvote 0

ltrebuchet

Member
Licensed User
Longtime User
here is the generated manifest.xml with the right lines number
 

Attachments

  • AndroidManifest.xml
    4.9 KB · Views: 250
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I tried Firebase Analytics:
Please USE Code tags when posting code!!!

codetag001.png


codetag002.png


codetag003.png



#additionaljar: com.android.support:support-v4
#AdditionalJar: wearable-2.0.0-alpha3.jar
#AdditionalJar: play-services-10.0.1.aar
#AdditionalJar: play-services-wearable-10.0.1.aar

The first is set correctly.
The second i´mnot sure if this belongs to google-libs...

the last two are WRONG.

See here for a list of the complete class-refences...
https://developers.google.com/android/guides/setup#add_google_play_services_to_your_project

Seing this

B4X:
#AdditionalJar: play-services-10.0.1.aar

'should be

#AdditionalJar: com.google.android.gms:play-services

Without the version and without .aar


The last should be
B4X:
#AdditionalJar:com.google.android.gms:play-services-wearable
 
Upvote 0

ltrebuchet

Member
Licensed User
Longtime User
Thank you very much
I had to use #ExcludeClasses to avoid to much time and memory, but it compiled with this code :)
B4X:
    #additionaljar: com.android.support:support-v4
    #AdditionalJar: com.google.android.gms:play-services
    #ExcludeClasses: .ads, .ads-lite, .all-wear, .appindexing, .appinvite, .appstate, .auth, .auth-base
    #ExcludeClasses: .awareness, .base, .basement, .cast, .cast-framework, .clearcut, .contextmanager, .drive
    #ExcludeClasses: .fitness, .games, .gass, .maps, .measurement, .nearby, .panorama, .places, .safetynet
    #ExcludeClasses: .tasks, .vision, .wallet
Thank you both, regards, Louis
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I had to use #ExcludeClasses
i dont think that these will be help... The classes you excluded are not in the compiling-process

Using the maven repos only the used references will be compiled into your app.
Usually ExcludeClasses is no longer needed.
 
Upvote 0

ltrebuchet

Member
Licensed User
Longtime User
Thanks to both, I understood better the maven repos by reading several of your posts.
With the single code:
B4X:
    #AdditionalJar: com.google.android.gms: play-services-wearable
I get compiled the play-services-wearable and the play-services-common and no other classes.
Thank you, Louis
 
Upvote 0
Top