com.google.android.maps not available - android

I'm new to Android and I'm using IntelliJ to develop. I'm going through various tutorials, etc and now I'm trying to run/compile Wrox project that uses com.google.android.maps
IntelliJ wouldn't compile, it complains that this package does not exist.
How do I add it to project? I have everything downloaded in ADT. I was able to run all other projects no problem. What should I look for?

You need to target the Google APIs instead of Android - in IntelliJ, File-Project Structure SDKs and select Google APIs in Build Target.

Are you targetting the correct Android-jar? You'd want the one with the Google API:s for maps to work. Also make sure you're including the correct permission in your manifest.

And after installing the google api and setting up a project based on the correct api, don't forget the uses-libary tag in the manifest:
<application
android:icon="#drawable/icon"
android:label="#string/app_name"
android:debuggable="true">
<uses-library android:name="com.google.android.maps" />

Related

Uploaded Android APK marked as Android Auto when not set in manifest

I've looked through my whole project directory, and for the life of me, I cannot find where it would think it is an Android Auto. Going through this page:
https://developer.android.com/training/auto/start/index.html#auto-metadata
Nowhere in my Android manifest, do I set an automotive.
Could a library add to the manifest to make it an Automotive app?
Are there other things in the manifest I can check?
Please cross check in your res/xml file and see if you have any media or notification
under - uses element.
You can also check in your manifest file if you have added Car GMS package in the meta-data element.
<meta-data
android:name="com.google.android.gms.car.application"
android:resource="#xml/your_auto_xml_file"
/>
If the library you are importing in happens to be from the merchant who builds up the customized DHU, then these lib can infuse those properties in your project. One easy way would be to remove the library and see if it resolves the issue.

Can I remove com.google.android.gms.version from AndroidManifest when I use gradle?

I wonder if I can remove this line safely:
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
from my AndroidManifest.xml when I use gradle to build my APK.
According to the website https://developers.google.com/android/guides/setup only when I choose "ECLIPSE WITH ADT" I have to add this line. For "ANDROID STUDIO" usage this is not mentioned.
But in my case I use Eclipse (with ADT) as IDE but I build with gradle. (Actually it is a libGDX project). So I added the play-services by using gradle:
compile "com.google.android.gms:play-services:8.1.0"
So I run the app on a test device and I tested to login with play-services and it worked fine without having the line above in my AndroidManifest.xml
But, maybe the login just does not need the "com.google.android.gms.version" value and another part of the play services lib needs it? But I cannot test all the possible ways to use the lib.
Does anybody know for sure?
Or for those of you who use Android Studio + play services: Does your AndroidManifest.xml have the line above?
Yes, as of Google Play services 7.0 (improved in 7.5 to remove the restriction on applying to the full play-services dependency), the <meta-data> tag is automatically added to your Manifest file by Gradle via Manifest merging.

Import Unity Ads SDK in Android Studio

I just finished an app for Android and I would like to integrate ads on it with Unity Ads. I have to import the Unity Ads SDK project so, I went to : File/Import Module. Once done I entered the path of the folder but after that, I am blocked : Android Studio shows me that :
What should I fill ?
A newer solution:
Go to File > New > New Module > Import .JAR / .AAR package
Select your .aar file (already inside /app/libs dir)
Add this gradle's app dependency: implementation project(path: ':unity-ads')
Now you are ready to use the SDK.
I found solution.
Download and unzip master zip
Go Android Studio File --> Open Module Settings --> click plus button.
When dialog open, you should choose Eclipse project module.
Select unity-ads package in master project.
And Finish.
Stay happy to code :)
I have never tried to import Unity Ads to an non Unity project.
I found this in the Unity website I hope it can be helpful but it's for eclipse...
https://unityads.unity3d.com/help/Documentation%20for%20Publishers/Integration-Guide-for-Android
To answer your question. You shouldn't need to put anything there. It's only if you want to be able to view the source of the library - intelli-sense. That being said, I didn't like that set up and went a different route which I found easier.
Here's what I did.
Download and unzip the master zip (pre-built packages)
Copy or move the ./unity-ads-sdk-master/unity-ads/libs/unity-ads.jar to your projects ./libs dir.
Copy the permissions and Activity definition from the provided AndroidManifest.xml file.
<application>
<activity
android:name="com.unity3d.ads.android.view.UnityAdsFullscreenActivity"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:hardwareAccelerated="true" />
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- Note: If android:maxSdkVersion attribute leads to problems when merging manifests, you can
remove maxSdkVersion attribute. Unity Ads on Android 4.4 or later won't need this permission so
maxSdkVersion means it is only requested for older Androids. -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
3a. Might need to refresh from your Gradle tool window.
Follow rest of instructions starting from Integrate Unity Ads to Your Codebase

<uses-library /> in Android Manifest

I'm a newbie for Android and I need help regarding this issue. I am developing a game using Eclipse. In my project, I added AndEngine and AndEngine Augmented Reality as libraries. I was testing the project out in my Android device, every time I tap the text which uses the class of AR, it force close. I was told to register AndEngine in my Android Manifest file. I have checked about it and used <uses-library />. Now, I placed these two lines in my manifest:
<uses-library android:name="org.andengine.extension.augmentedreality"
android:required="true"/>
<uses-library android:name="org.andengine"
android:required="true"/>
but I get this error message: Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
when I comment out those <uses-library /> lines, I can run the app but it force close when tapping the text that directs to the class of AR. Anything wrong in using it? Or any better way in doing it? Please post all your advises in an easy-to-understand-for-newbies way. THANK YOU!
<uses-library> is not meant to include libraries in your application. It is used to restrict app availability in Google Play based on the availability of a library already on the device like maps. AndEngine is a library project so include it in your build via Ant, Maven or whatever IDE you use.
In case you aren't familiar with what a library project is here's a link:
https://www.vogella.com/tutorials/AndroidLibraryProjects/article.html
If this element is present and its android:required attribute is set
to true, the PackageManager framework won't let the user install the
application unless the library is present on the user's device.
<uses-library> - specifies a shared library that the application must be linked against. This element tells the system to include the library's code in the class loader for the package.
creat a libs folder inside the res folder and put the AndEngine jars in it.set the class path of jar.

INSTALL_FAILED_MISSING_SHARED_LIBRARY error in Android 2.2 API Level 8

maybe somebody can help me out. i'm trying to add a google maps within my android app. if i want to run my app in emulator, i get the error: "Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY". of course i read about what my problem, the reason seems to be that the target device doesn't have the needed libs, but i'm not able to solve my problem :-(
in my manifest i've set the permissions:
uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"
uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"
uses-permission android:name="android.permission.INTERNET"
Additionally i defined the maps lib under my application-tag:
uses-library android:name="com.google.android.maps"
Furthermore i obtained an api maps key for my certificate md5-key and use this in my layout:
<com.google.android.maps.MapView
android:id="#+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="07ldFF5M8bvwFSB2DeeUIIvOhyKLNpWkFlTbS6w"/>
i don't think that my problem is within my app, could it bee an "target-problem"?
i try to compile vs. Android 2.2
i also tried to create a new AVD with Target "Google APIs (Google Inc)", but i cannot run my app with this AVD, don't ask me why :-((
i hope anybody can tell me how to solve this problem, thx in advance
if you want to have a look at my source, you can get it here:
http://www.marcusegger.de/examples/QuickPortfolio.zip
cheers, michbeck
You need to compile against "Android 2.2 Google APIs", not just "Android 2.2". You choose this in your IDE as the target Android platform.
I don't know much about Android but when I see your code I don't find the class which inherits 'MapActivity' class of Google map and run it on target GoogleAPI +Android 2.2

Categories

Resources