I have done everything according to this page:-https://developers.google.com/maps/documentation/android/start
But i only see a blank grey page with Google logo and +/- sign. Some people say my API key is wrong but i have generated my API key a 100 times but still no luck. My code is the same as provided on Google developer page. I have given the link above. I am done trying everything now please someone help me.
This is my java code:-
package com.example.gps;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
This is my xml layout code:-
<?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"
android:name="com.google.android.gms.maps.MapFragment"/>
This is my manifest code:-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.gps"
android:versionCode="1"
android:versionName="1.0" >
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<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" />
<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>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyA0aKSCV1vZXmJN4Xht440rDWu8NWqrgD0" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>
Also it is working on my emlator but not my device
Finally found the solution people.
When you export your apk make sure you export it with debug.keystore.
i.e., The same SHA1 signature which you registered with Google API console.
Related
The app works as expected. - it is only the IDE that apparently fail to upload/run it.
05/15 14:37:53: Launching 'app' on Google Glass 1. Install
successfully finished in 1 s 954 ms. Could not identify launch
activity: Default Activity not found Error while Launching activity
My manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="no.ut.glassbrowser"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name">
<activity
android:immersive="true"
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="#xml/voice_trigger" />
</activity>
</application>
</manifest>
What Am I missing?
In your "intent-filter" tag you should have this code
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
This is the manifest file
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<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.permissions.READ_GSERVICES" />
<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.geo.API_KEY"
android:value="#string/google_maps_key" />
<activity
android:name=".Map"
android:label="#string/title_activity_map">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
This app is suppose to find nearby places but whenever i click the button to search nearby places, it crashes
This is the logcat image but i dont understand
I am trying to debug may Android Things BLE app in Android Studio. I am trying to do a simple scan on my main activity thread but I keep getting this exception:
01-17 02:13:24.735 29032-29044/com.dv.iotitag W/Binder: Caught a RuntimeException from the binder stub implementation.
java.lang.SecurityException: Need ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission to get scan results
at android.os.Parcel.readException(Parcel.java:2004)
at android.os.Parcel.readException(Parcel.java:1950)
at android.bluetooth.IBluetoothGatt$Stub$Proxy.startScan(IBluetoothGatt.java:920)
at android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper.onScannerRegistered(BluetoothLeScanner.java:442)
at android.bluetooth.le.IScannerCallback$Stub.onTransact(IScannerCallback.java:56)
at android.os.Binder.execTransact(Binder.java:697)
I have the permissions in the manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dv.iotitag">
<uses-feature android:name="android.hardware.bluetooth_le" />
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<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" />
<uses-permission android:name="com.google.android.things.permission.MANAGE_INPUT_DRIVERS" />
<uses-permission android:name="com.google.android.things.permission.MANAGE_BLUETOOTH" />
<application>
<uses-library android:name="com.google.android.things" />
<service
android:name="com.dv.androidthings.ble.common.BluetoothLeService"
android:enabled="true" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.IOT_LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
but I still keep getting the exception in debug mode. What am I doing wrong?
From API 23 (Android 6.0) it is not sufficient to declare permisions in Manifest.xml. You have to request them in runtime as described here.
Go to your applications inside your phone and make sure your have location enabled and have it turned on.
In you oncreate method call:
checkPermission();
public void checkPermission() {
if (Build.VERSION.SDK_INT >= 23) {
if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED && checkSelfPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
//
} else {
ActivityCompat.requestPermissions(this, new String[]{
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION,}, 1);
}
}
}
I'm trying to generate an APK from Android Studio for publish it on the play store.
Now when i generate the APK i got this error:
I can start the app but "Generate APK" not work and for avoid this error i copy my Facebook App Id from my string.xml to my manifest:
android:value="2132153153153535"
Instead of:
android:value="#string/facebook_app_id"
Now i can generate the APK but when i launch my app from the playstore i got this error:
Unable to start activity ComponentInfo{com.stable.giamma.sushichallenge/com.stable.giamma.sushichallenge.MenuActivity}: java.lang.IllegalArgumentException: Both context and applicationId must be non-null
That i can resolve by reversing the modify that i just did.
But if i do so i can't generate the APK again.....
What is the right way for handle the "facebook app id" and generate the APK?
p.s: i have 2 string.xml (one is for english and the other for italian language) dunno if create some problem...
Here is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.asd.appname">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
o
<application
android:allowBackup="true"
android:icon="#mipmap/asd"
android:label="#string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" /> //THIS IS THE STRING THAT I MODIFY FOR AVOID THE FIRST ERROR
<activity
android:name="com.asd.MainActivity"
android:label="#string/app_name"
android:screenOrientation="landscape"
android:theme="#style/AppTheme.NoActionBar" />
<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.asd.MenuActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.asd.SushataActivity"
android:label="#string/sushata"
android:parentActivityName="com.asd.MenuActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.asd.MenuActivity" />
</activity>
<activity
android:name="com.asd.Sushata2Activity"
android:label="#string/sushata2"
android:parentActivityName="com.asd.SushataActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.asd.SushataActivity" />
</activity>
<activity
android:name="com.asd.Leaderboard"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar"></activity>
</application>
I added:
tools:ignore="ManifestResource"
The correct code is:
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id"
tools:ignore="ManifestResource"/>
Now seems work I found this stackoverflow post helpful: link
My problem can be summed up in one picture which can be see in this location:
http://imgur.com/qOiyl
The application had originally been developed for smartphone, and on a small resolution there is no problem, the application fills the whole screen. But in tablet, as you can see, only the size corresponding to a smartphone is used.
I guess that this means that somewhere the height and width values are hard set. But I cannot see where! Where is it possible to set height and width for all the application (all activities are doing the same thing).
Here is my AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dombox.app"
android:versionCode="11"
android:versionName="2.0.4" >
<uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" >
</uses-permission>
<uses-permission android:name="android.permission.INTERNET" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" >
</uses-permission>
<application
android:icon="#drawable/icon"
android:label="#string/app_name" >
<activity
android:name=".activity.DomboxHome"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="android.test.runner" />
<activity
android:name=".activity.list.ZonesList"
android:label="#string/app_name" >
<intent-filter>
<action android:name="Dombox.MENU" />
</intent-filter>
</activity>
<activity
android:name=".activity.list.EquipementsList"
android:label="#string/app_name" >
</activity>
<activity
android:name=".activity.PullToRefreshActivity"
android:label="#string/app_name" >
</activity>
<activity android:name="org.achartengine.GraphicalActivity" />
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:label="Tests for Android Dombox"
android:targetPackage="com.application.androiddombox" >
</instrumentation>
<activity
android:name=".activity.list.SuiviConsoList"
android:label="#string/app_name" >
</activity>
<activity android:name=".activity.list.PlanningList" android:label="#string/app_name"></activity>
</application>
And here is one of mine layout (there are all in the folder /res/layout/)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<fragment
android:name="com.dombox.app.fragment.MenuFragment"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:id="#+id/menu_fragment"
android:layout_weight="30">
<!-- Preview: layout=#layout/list_text -->
</fragment>
<fragment
android:name="com.dombox.app.fragment.SettingsFragment"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:id="#+id/settings_fragment"
android:layout_weight="70">
<!-- Preview: layout=#layout/settings -->
</fragment>
</LinearLayout>
Do you have any idea?
I think your app is running in compatibility mode, Put this piece of code just before the <application> tag in your manifest file.
<supports-screens android:largeScreens="true"
android:normalScreens="true" android:smallScreens="true"
android:anyDensity="true" android:xlargeScreens="false" />
Hope that works,
I think you need to set android:weightSum="100" to your LinearLayout
You can try to add
<supports-screens android:xlargeScreens="true" />
in AndroidManifest.xml. This tells the system that your app is compatible with xlarge screens (tablets), and that your app should be stretch to fill screen.
Yes you are obviously missing one of the important stuff.
There is no supports-screen tag in your manifest file, so by default "normalScreens" is set to true and all others false.
Here is the link for more info on Supporting Multiple Resolution.
Also check this link