[GUIDE][HOW-TO]How to use Google Play Services library with Android Studio - Android Studio

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
One thing that's actually annoying for some developers that trying to migrate to Android Studio, is when they want to referring an external libraries (for example, Google Play Services library) to their app. Android Studio is based on Gradle-build, so it's quite different. I'm experimenting this trouble for some time, and now I have the answer based on my experience and research.
Before we start, are you still a new with Android Studio? Please refer to my great getting started guide that you can find here. That guide is also posted in XDA-University. And please click "Thanks" if you found my article is helpful.
Let's get started! How to use Google Play Services library with Android Studio?
- First, open your build.gradle file. Which build.gradle file should I use?
- Copy google-play-services.jar from $ANDROID-SDK/extras/google/google_play_services/libproject/google-play-services_lib/libs to a location. Let's call this location -> $GOOGLE_PLAY_LIB
- If you have already use another dependencies (for example: Android Support library), we'll use a list. Move your "compile" part from "dependencies" to this list.
Example (I used Google Support v7):
Code:
List myDependencies = ["com.android.support:appcompat-v7:18.0.+"]
dependencies {
//moved into List above, so there'll be nothing here.
}
- Also add your Google Play Library in your dependency. We'll use fileTree(). Example:
Code:
List myDependencies = ["com.android.support:appcompat-v7:18.0.+", fileTree (dir: '$GOOGLE_PLAY_LIB', includes: ['*.jar'])]
- Don't forget to change $GOOGLE_PLAY_LIB into your real location. Example: 'E://Android/Development/Lib'
- Now change the dependencies part:
Code:
List myDependencies = ["com.android.support:appcompat-v7:18.0.+",
fileTree (dir: 'E://Android/Development/Lib', includes: ['*.jar'])]
dependencies {
compile myDependencies
}
- Just wait when it compiling and making the project. And you're ready to go!
I use this tricks in my project to use Google Android Map v2, and it worked. But if you have any trouble in applying this, please tell me.

great tutorial
Hi,
Thanks! After some hours of searching how to use a library on android studio, this tutorial is the only one which has allowed me to compile the project!!

You're welcome. And if you don't mind, please share this to your fellow developers. So that they can get benefits too.
Cheers
:highfive:
lotdrops said:
Hi,
Thanks! After some hours of searching how to use a library on android studio, this tutorial is the only one which has allowed me to compile the project!!
Click to expand...
Click to collapse

there is an easier way to do this:
Just download Google Repository & Google Play Services from SDK and put this in build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 8
targetSdkVersion 18
}
}
dependencies {
compile('com.android.support:appcompat-v7:18.0.+')
compile('com.android.support:support-v4:13.0.0')
compile ('com.google.android.gmslay-services:3.2.25')
}
Click to expand...
Click to collapse
NOTE: if dont work, try clicking the button to the left of AVD Manager

Wow! That's a great one tricks.. Thanks for sharing this.
bamsbamx said:
there is an easier way to do this:
Just download Google Repository & Google Play Services from SDK and put this in build.gradle:
NOTE: if dont work, try clicking the button to the left of AVD Manager
Click to expand...
Click to collapse

Other way of copiling Google Play library
Hey
What about this way, think this might work as well, just writing
compile files('libs/google-play-services.jar')
in dependencies. You should of course copi the jar file into your libs folder in the project.

JoshieGeek said:
One thing that's actually annoying for some developers that trying to migrate to Android Studio, is when they want to referring an external libraries (for example, Google Play Services library) to their app. Android Studio is based on Gradle-build, so it's quite different. I'm experimenting this trouble for some time, and now I have the answer based on my experience and research.
[...]
I use this tricks in my project to use Google Android Map v2, and it worked. But if you have any trouble in applying this, please tell me.
Click to expand...
Click to collapse
That works, but only for compiling. At runtime NoClassDefFoundError is thrown. For 'SupportMapFragment' in my case

Related

Samsung Opensource

Does anyone know what the files from http://opensource.samsung.com/ are?
Can you build the stock rom that way? It doesn't seem like you can, i downloaded it and tried to build it following the instructions but i didn't have much luck
did anyone else try to compile it?
the readme file
Code:
1. Get android open source.
: version info - Android gingerbread 2.3.3
( Download site : http://source.android.com )
2. Overwrite files that you want to build.
[...]
3. Add the following lines at the end of build/target/board/generic/BoardConfig.mk
[...]
4. make
- ./build.sh user
First of all, you are in the wrong section. All questions should go to Q&A section.
Secondly, that site is only for Kernel Source codes I believe (Correct me if I'm wrong) and I guess, you won't get their ROM source codes.
sorry for posting in the wrong section
i'm not sure it's just the kernel, there;s also a platform archive there
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
the platform folder contains convincing folders
The platform folder contains a small subset of the ROM, in fact the instructions instruct you to download the official source code from source.android.com. There isn't any proprietary Samsung software (i.e.: Touchwiz).
With those files you should be able to compile a pure AOSP ROM without Google proprietary apps (Play Store, GTalk, ...).
hrk said:
The platform folder contains a small subset of the ROM, in fact the instructions instruct you to download the official source code from source.android.com. There isn't any proprietary Samsung software (i.e.: Touchwiz).
With those files you should be able to compile a pure AOSP ROM without Google proprietary apps (Play Store, GTalk, ...).
Click to expand...
Click to collapse
well i am definitely interested in compiling a pure aosp rom that will run on my samsung, i tried it multiple times by those instructions but haven't had much luck

[TOOL][DEV]MyFirstRom v1.0.0.0 by GG2SD #myfirstrom

Hello everyone users, today I want to present my latest creation: MyFirstrom.
Requirements:
Code:
-Microsoft. NET Framework 4.5.1 available: [URL=http://go.microsoft.com/?linkid=9839392] HERE [/URL]
-Java JDK 8 available: [URL=http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html] HERE [/URL]
-Android SDK Tools available: [URL=http://dl.google.com/android/installer_r22.6.2-windows.exe] HERE [/URL]
This tool works on Windows, Linux and Mac OS (linux and mac I have not tested it yet, but to do so would run Wine, as it was developed for Windows, and have the extension *. Exe).
Here are the main features:
Code:
[COLOR="Red"][SIZE="5"]FEATURES:[/SIZE][/COLOR]
-Decompile Apk
-Rebuilding Apk
-Sign Apk
-Create un-sign zip
-Create signed zip
-Edit build.prop
-Edit the Update-Script
-Create tweaks / scripts to be included in the folder init.d
-Add Apk to rom and update.zip
Here are the screenshots:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Set development environment:
JAVA:
Code:
Download and Install the JDK 8 on the link above, open the Control Panel and look for "Advanced System", open it and click on "Environment Variables ..."
find the path variable and add these lines to the end:
"C:\Program Files\Java\jre8\bin;"
[COLOR="Red"][SIZE="5"]WARNING:[/SIZE][/COLOR]
if you have a 32-bit system you will need to change the lines and add these in place of those:
"C:\Program Files (x86)\Java\jre8\bin;"
SDK-PLATFORMS:
Code:
Create a folder in the path "C:\" and call it "Android", install the sdk-platforms and use this folder as the installation folder.
Open the environment variables and add these to the string variable path:
"C:\Android\platform-tools";
without the quotes.
Now that we have set the development environment can run the installer and install the tool.
For those wishing to publish a custom rom created with this tool will add to the post title or the hashtag #myfirstrom #mfr.
I hope this tool will serve to many of you, especially those who are beginners.
Thanks:
Code:
-Abhi922 for the rom base that is the simplicity v5
-The team that created ApkTool and SignApk
-Me for the tool and the GUI
-Benzyniarz1 the inspiration for the design of update zip creator
Here is the download link:
Setup.exe
For anyone wishing to make a donation to allow the tool to move forward with the development please click below:
PS:
This tool was developed for Windows 8 and 7 do not think that they appear fine objects.
On the login screen to access the tool the default username and password are: root.
But you can change to create a new account.
THANKS!!!
Hello!
Good thing for starters (aka noobs/newbies/etc). Maybe there will be danger of ROM flooding in Dev thread, but still good
Best regards.
devloz said:
Hello!
Good thing for starters (aka noobs/newbies/etc). Maybe there will be danger of ROM flooding in Dev thread, but still good
Best regards.
Click to expand...
Click to collapse
Thanks man!!!
In the next version add a new functionality: Download The Rom for a specific device!!!

Where to find all the latest Google Play store and all the related service apk?

Recently I flashed my phone, so it missed all the files on the storage.
Now I want to install google play store back on. But I couldn't find all the right apk on the web.
Anyone could provide some link for the latest google service apk please?
I think I need:
Google Framework Service apk
Google Play Service apk
Google Play Store apk
Google Login Server/Account Manager apk
Thank you.
Uh, why didn't you just flash any GApps package?
http://opengapps.org/
Thanks for your reply.
I am not sure what platform of my Mi 2S is, seems ARM but could be ARM64 as well.
And if I just want to install Google Play Store, then I will install all the apps including Google's, which variant should I pick? Nano?
xiaohan said:
Thanks for your reply.
I am not sure what platform of my Mi 2S is, seems ARM but could be ARM64 as well.
And if I just want to install Google Play Store, then I will install all the apps including Google's, which variant should I pick? Nano?
Click to expand...
Click to collapse
Mi2S's SoC is ARM based, so you should choose it. ARM64 is started from Snapdragon 401 and above.
Nano is a good start, although if you want all Google Apps included, you probably need to use Full or Stock (if you want to replace all AOSP app with its Google's counterparts).
And lastly, this is Mi3 forum. Mi2 and Mi2S' forum is right here: http://forum.xda-developers.com/mi-2
Thanks. I tried asking in Mi 2S forum, nobody seems know the answer.
And I tried to flash the package in recovery mode, but it doesn't allow me to do that.
Any detailed instruction or somewhere I can just download the latest packages for these 4 basic but essential apks?
Google Framework Service apk
Google Play Service apk
Google Play Store apk
Google Login Server/Account Manager apk
Thank you.
I keep getting this error:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
What ROM do you used actually? Is it MIUI?
rxl.noir said:
What ROM do you used actually? Is it MIUI?
Click to expand...
Click to collapse
Yes, the latest stock MIUI 7 for MI 2S. Flashed from computer to combine the 4GB ROM and the rest of 27-28GB internal storage initially separated by manufacturer.
xiaohan said:
I keep getting this error:
View attachment 3711012
Click to expand...
Click to collapse
https://www.youtube.com/watch?v=1IujFpuP3NE

[Stable] SlimVXposed - New way to enable Xposed modules without ROOT or BL unlocking!

SlimVXposed Official Post​Powered by SlimHook​What is SlimVXposed ?​SlimVXposed is a software that enable Xposed modules on device without root and package modifying.
Currently support modules like FakeLocationXposed, SPromoter, FaceBookXposed, Telegram helper, Android Faker,
MDWeChat......
How to use ?​Download SlimVXposed from github or gitee, clone applications and modules (Click add button), click application you install in SlimVXposed,
the Xposed modules will be activate and only perform on app that clone into SlimVXposed.
Why SandVXposed renamed ?​SandVXposed is now only available for business.
As origin developer of SandVXposed, I make a new hook framework for VirtualApp named SlimHook.
SlimVXposed is always for free and never provide paid version.
Platform compatibility​Android 2.3 - 12 Beta 2 (May work on future version of Android 12)
Harmony OS 2.0 API 5 (Based on Android 10)
Honor Magic UI 4.2 (Based on Android 11)
Contact & Download​Download SlimVXposed (svxp64 for 64bit and svxp for 32bit)
http://www.die.luhttp://spatch.die.luContact me:
EMail: 1#die.lu (replace # to @)
2nd floor is reserving for update and announcing.
Please give download link of FaceBookXposed module you mentioned in the OP.
What is the difference between that and virtualxposed?
Skorpion96 said:
What is the difference between that and virtualxposed?
Click to expand...
Click to collapse
SlimVXposed now no longer use VirtualApp core, so its behaviour may be diff when you launch or install an app into SlimVXposed.
SlimVXposed currently using Foza core for virtualization and support SPromoter directly.
For Android 6-13, use SlimVXposed is better.
Hey there. I'm new to this.
Can you help me to use this SlimVXposed.
I have Android OS 11.
I want to use it to fake my location.
I have install SlimVXposed, I don't know how to use it. Where to get Xposed Framework for SlimVXposed and also which fakegps module will work with it. Can you please further elaborate and help me with links.
What can I do to make Google services work?! I already installed the fakeGapps module but it doesn't work, even the internal option of SlimVX doesn't work either. Please help
Android 11.
Potatoxskull said:
What can I do to make Google services work?! I already installed the fakeGapps module but it doesn't work, even the internal option of SlimVX doesn't work either. Please help
Android 11.
Click to expand...
Click to collapse
I second this. FakeGapps doesn't work. Please help.
Thanks, now I can use Japanese TikTok server without root. I thought it doesn't gonna work but wtf
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}

When I press the Run button, the app on the emulator does not start

Hello everyone,
imgui/examples/example_android_opengl3 at master · ocornut/imgui
Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies - imgui/examples/example_android_opengl3 at master · ocornut/imgui
github.com
My project is based on this C++ project in Android Studio (ImGui). I had successfully compiled and run the project using the older Android Studio version 2021.3.1.17. However, upon upgrading to Android 2022.2.1 Patch 1, I encountered numerous errors, some of which remained unresolved even after several attempts at restarting, reinstalling, cleaning, and rebuilding the project.
Additionally, I have question: When I press the Run ► button, the app on the emulator does not start. According to the logs, the app, was successfully installed. However, when I touch its icon (ImGuiExample), I get the message "App isn't installed". Can anyone suggest a solution to this problem?
I have a difficult question that I hope someone can help me with: Is there a lightweight version of Android Studio that I can use to build my project without having to download so many SDK files? I believe a lightweight software with fewer SDK files will make it easier for developers to fix bugs, the Android Studio I use has so many SDK files.
Thank you in advance for your help.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I am not entirely certain, but I believe that the project was working fine with the old Android Studio 2021, likely because Imgui 1.89 worked but this is Imgui 1.89.6 (a newer), and I uninstalled the old Android Studio.
The solution for me is to downgrade to android-studio-2021.3.1.17. If the breakpoints don't work too for ndkVersion "25.1.8937393" for example then downgrade to ndkVersion "21.4.7075529". The key is then to switch between versions, and you can stick on one version without changing to another version for a long time.
But why, Android Studio has so many versions, I mean a lot? And it's difficult to find the perfect version.

Categories

Resources