I am trying to add the Sensoro Smart Beacon -4AA android SDK to my android application.
The instruction on their official page Sensoro Development show that I should download SDK folder and put it in libs folder, I added them as shown in the screenshot. Then add the following services to my Manifest file :
<service android:name="com.sensoro.beacon.kit.BeaconProcessService"/>
<service android:name="com.sensoro.beacon.kit.BeaconService"/>
<service android:name="com.sensoro.beacon.kit.IntentProcessorService"/>
But the application can't detect the services and I searched for files with the names of the services but I didn't find them.
I think the services files should be available in the SDK folder but I can't find them. Is that correct or I am missing something
this is the manifest file code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="project.college.qmeup">
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<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/Theme.Qmeup"
android:usesCleartextTraffic="true">
<service android:name="com.sensoro.beacon.kit.BeaconProcessService"/>
<service android:name="com.sensoro.beacon.kit.BeaconService"/>
<service android:name="com.sensoro.beacon.kit.IntentProcessorService"/>
<activity android:name=".Admin"></activity>
<activity android:name=".Usermain" />
<activity android:name=".Login" />
<activity android:name=".Registeration" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
To add jar files to an Android Studio project you typically do two things:
Put the jar files in the app/libs folder
Modify your app/build.grade file to point to this folder
You shown putting the jars in the root /libs folder (not under app) and do not mention adding the reference to build.grade. See this answer for more info:
https://stackoverflow.com/a/25660223
Shameless plug: If you get totally stuck, you might want to try using my open source Android Beacon Library, which is easier to set up, has full documentation and good support. (It is so good that I even support other people’s libraries, too!)
https://altbeacon.github.io/android-beacon-library
So i followed this guide https://developers.google.com/maps/documentation/android-api/signup
and created a new Google Developer Console project in here
https://console.developers.google.com/home
I put my Eclipse project package name and got the Google Key.
Now as the guide said i added this to my manifest
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_API_KEY"/>
and after i did that i have got a lot of errors in my project and there's also an red exclamation mark near all of my projects of this workspace.
So what I'm doing wrong? I just want to start develop using google play. And please, i read all the guides in their and eclipse's and i still can't get it to go.
EDIT
I think i might missed the google play services library. I cant find where to download it.
manifest: as requested.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.minyan.get.dl"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="23" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission
android:name="android.permission.INTERNET"/>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MyLocation"
android:label="#string/title_activity_my_location" >
</activity>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCzVDpAckc5p3DGRIJsco-CyIiFfjgn--k />
</application>
</manifest>
Like in the guides the <meta data /> is in the application tag.
To make the Google Play services APIs available to your app:
Copy the library project at <android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/ to the location where you maintain your Android app projects.
Import the library project into your Eclipse workspace. Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it.
After you've added the Google Play services library as a dependency for your app project, open your app's manifest file and add the following tag as a child of the <application> element:
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Basically google play services library is not needed to download, it resides in your SDK only
and here is the path, you can find the library
.../sdk/extras/google/google_play_services/libproject/google-play-services_lib
I think the following could solve your problem:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCzVDpAckc5p3DGRIJsco-CyIiFfjgn--k" />
^
!
I had my existing android project going unmanageable due to unnecessary research codes, so I decided to create a new project with only necessary code that's required for the app. I uploaded the same on play store's beta environment. As the app got updated on my phone, the already existing app icon on home screen got removed. Did I make any mistake in the code development?
Please help
EDIT: Added Manifest File
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.abc"
android:installLocation="preferExternal"
android:versionCode="52"
android:versionName="5.0.004" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:name="com.example.abc.Appname"
android:allowBackup="true"
android:icon="#drawable/launcher"
android:label="#string/app_name"
android:theme="#style/Theme.CustomTheme" >
<activity
android:name="com.example.abc.SplashScreen"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/title_activity_app_name"
android:theme="#android:style/Theme.Black.NoTitleBar"
android:windowSoftInputMode="stateHidden" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
...
</manifest>
Reverted back the application name to old file name (java class) and the same in manifest file. The launcher icon was created while installing via Google play store's beta environment.
Still unsure why the application name and java class names had an impact on the launcher icons. Any idea?
I'm having the blank screen and zoom buttons issue and I think all permissions and my key codes are typed correctly, the project is registered at the Google's APIs Console site and Google Maps Android API v2 service is checked
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myProject"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="10" />
<permission android:name="com.myProject.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<uses-permission android:name="com.myProject.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.myProject.ScreenMap"
android:label="#string/app_name" >
<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.maps.v2.API_KEY"
android:value="myKey"/>
</application>
</manifest>
So I was looking at that jar's path and it's size is only 1kb, so I'm curious if the jar is damaged since the google-play-services's jar's size is about 578kb
Just to clarify the 1kb JAR phenomenon :
The Google Play Services Library Project itself doesn't contain any (real) java code. It contains a single dummy UnusedStub.java, simply because the Android tooling / build system needs at least 1 java class otherwise it is considered an invalid project.
adt-bundle-windows-x86_64-20130514\sdk\extras\google\google_play_services\libproject\google-play-services_lib\src\android
This is in fact the 1kb JAR you are probably seeing.
The actual Google Play Services code is in the libs folder of the Google Play Services Library Project.
adt-bundle-windows-x86_64-20130514\sdk\extras\google\google_play_services\libproject\google-play-services_lib\libs\google-play-services
That is 578kb JAR containing the com.google.maps.gms package and classes (the actual Google Maps V2 code.
If you didn't mess around with the library project, and simply added it as a reference to your project, you should see 2 JAR files in your projects bin/dexedlibs folder
google-play-services_lib-85cb1c92715dbebbf9272cc8771ff1ee (1kb - the library project)
google-play-services-802bdd645fa52832629ef9a428b8df7e (the JAR file in the libs folder of the library project)
I assume you have correctly imported the library project, otherwise your project would not be able to resolve any classes imported from the com.google.maps.gms package.
You need to check the ADB logs to see what is going on while the map is being displayed. Most likely it's an authentication issue. Double check your API key and the API console and make you sure you entered everything correctly :
I'm trying my hand and Android Application Development. I'm currently using Eclipse (I can't remember the version, whatever the newest is). I've crossed a bridge where I just can't seem to grasp what I'm doing wrong. I'm attempting to use the Google Maps V2 API. I've been through several documents and tried several techniques, all of which lead to the same error:
Android.view.Inflate Exception: Binary XML file line #2: Error inflating class fragment
I've been pounding my face into the keys for 2 days straight trying to grasp what I'm doing wrong here.
Things I've done:
Started with a blank activity.
Project -> Properties -> Android -> Project Build Target is Google APIs - 4.2 - API 17 - I've tried every other option as well (as long as above version 3.0, found it documented
Added the google-play-services_lib to my Package Explorer. I indicated that the google-play-services_lib was indeed a library.
Project -> Properties -> Android -> Library -> Add -> and I choose the location to the google-play-services_lib.
Included android-support-v4.jar as a dependency of my project.
I've tried so many different answers from questions similar to mine, but to no avail. :(
I can usually figure these things out, but maybe I'm just too overloaded.
My package explorer tree in eclipse looks like
google-play-services_lib
Svma
Here's the code:>
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.testing.svma"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="17" />
<permission
android:name="com.testing.svma.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.testing.svma.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.testing.svma.MainActivity"
android:label="#string/app_name" >
<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.maps.v2.API_KEY"
android:value="SHA1_Generated_KEY_HERE" />
</application>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
</manifest>
MainActivity.java
package com.testing.svma;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class MainActivity extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Reference Documents
I used “Error inflating class fragment” with google map to try and fix my issues.
I referenced This google maps quick start guide to create my project.
I had started initially with the sample code from the Introduction to the Google Maps Android V2 Api
A whole slew of SO questions.
So, SO Community, what am I doing wrong? Why am I unable to grasp this simple concept.
Thank you in advance.
I know this is probably a dead thread but just in case someone stumbles upon here having an identical problem - your manifest might be missing the following meta information:
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Declare it within the <application> element and your code should work. I ran into the same issue following a youtube tutorial that skipped this step and only when carefully going through the original Google tutorial I noticed the missing code.
Anyway, hope this helps someone.
I have the same code/same problem! Try adding android:name="com.testing.svma.MainActivity" to "fragment" in the layout! It solved the issue for me
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"
android:name="com.testing.svma.MainActivity"/>
I had the same problem, solved it by modifying the Manifest.
This is my manifest.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="example.gps"
android:versionCode="1"
android:versionName="1.0" >
<permission
android:name="example.gps.permission.MAPS_RECEIVE"
android:protectionLevel="signature"></permission>
<!-- Copied from Google Maps Library/AndroidManifest.xml. -->
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="17"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- External storage for caching. -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- My Location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!-- Maps API needs OpenGL ES 2.0. -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<!-- End of copy. -->
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:hardwareAccelerated="true" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="<YOUR VALUE>"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name="example.gps.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
And the xml file is
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"
/>
The java class is
public class MainActivity extends FragmentActivity
{
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
That solved my problem
Try to add google-play-services library reference to your project. If you are using Eclipse, you need to go to Project->Properties->Android and Add google-play-services library project.
ALTERNATIVELY,
You can modify project.properties file manually.
Try to add reference to your google_play_services library. So my project.properties file looks like:
# Project target.
target=android-17
android.library.reference.1=../../../android-sdks/extras/google/google_play_services/libproject/google-play-services_lib
In your case path to google-play-services lib may be different
I tried to import your code and it crashed as well. When I modified properties file - I've got map running
I spend a lot of time trying to solve this problem and after much reading and trying, I solved by changing the
public class MainActivity extends FragmentActivity
for this
public class MainActivity extends android.support.v4.app.FragmentActivity
I hope this can help you
Had tried all the above answers over a period of a couple of days and then eventually this worked:
Project -> Properties -> Android -> Project Build Target
Changed the project build target to android 4.3(API 18) and clicked apply
In the manifest I then manually changed the min and target sdk versions:
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="18" />
This now matches the target=android-18 in the project.properties file (which resulted from the project build target change we did first)
I also tried android:minSdkVersion="11" which worked so the targetSdkVersionis the important bit.
Hope this helps someone!
I had the same problem and I did the mistake to only add one of the 2 following tags.
The actual error is really misleading, as you might be thinking of some API level UI issue.
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="<YOUR VALUE>"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Note that you are also missing one of these two
Frequently the problem is in Manifest.xml , so be sure that you write the right permissions like :
`
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zako.android.locationapi.maps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="17" />
<permission
android:name="com.zako.android.locationapi.maps.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<!-- Required OpenGL ES 2.0. for Maps V2 -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<!-- Requires OpenGL ES version 2 -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.zako.android.locationapi.maps.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.zako.android.locationapi.maps.MainActivity"
android:label="#string/app_name" >
<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.maps.v2.API_KEY"
android:value="......" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>
`
don't forget <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
and <meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
I had a similar error and I think it comes from this point: when I include the Google Play Service API I do not copy it in my workspace, I use the original one !!!
Note: You should be referencing a copy of the library that you copied to your source tree—you should not reference the library from the Android SDK directory.
Check this point.
I have got similar problem that I resolved by right click project->tools>add support library ...
and setup library
I hope this help you
Just include the following line of code on onDestroy()
SupportMapFragment mapFragment = ((SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map_location_sharing));
if(mapFragment != null) {
FragmentManager fM = getFragmentManager();
fM.beginTransaction().remove(mapFragment).commit();
It worked for me.Hopefully gonna work for you too. Thanks
I had this error too and it was due to EXTERNAL PERMISSIONS. It has no sense but I added this permission and since then everything worked fine.
In Some of android 6.0 mobile this exception is bug
If unable to flat XML cause by
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Configuration android.content.res.Resources.getConfiguration()' on a null object reference
Then it is active bug in android
https://issuetracker.google.com/issues/35827842
This can be solved by adding
android:hardwareAccelerated="true" adding in activity tag
using both meta data references was resolving the issue in my case:
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="yourAPIkeyFromGoogleAPIConsole" />
I simply added API key to manifest and it helped
I was facing the same problem I just added the API_KEY to Manifest and every thing is fine.
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/map_api_key" />