Can't open .xlsx file from aspose cells if it wasn't created using aspose cells - aspose-cells

So I'm working on an app for android and I've gotten it to work as long as it's been created using aspose cells. Here is my code:
class Home: Fragment(R.layout.fragment_home) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val view: View = inflater.inflate(R.layout.fragment_home, container, false)
val load = view.findViewById<Button>(R.id.button3)
val new = view.findViewById<Button>(R.id.button4)
val editText = view.findViewById<EditText>(R.id.editTextTextPersonName)
new.setOnClickListener(View.OnClickListener {
Excel.name = "${Environment.getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS)}/${editText.text.toString()}.xlsx"
Excel.workbook = Workbook()
Excel.workbook!!.save(Excel.name)
println("Created: ${Excel.workbook}")
})
load.setOnClickListener(View.OnClickListener {
Excel.workbook = Workbook("${Environment.getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS)}/${editText.text.toString()}.xlsx")
Excel.name = "${Environment.getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS)}/${editText.text.toString()}.xlsx"
Excel.workbook!!.save("${Environment.getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS)}/${editText.text.toString()}.xlsx")
println("Loaded: ${Excel.workbook}")
})
return view
}
}
the problem is when I try to download a .xlsx file and load it, it gives me this error:
Caused by: java.io.FileNotFoundException: /storage/emulated/0/Download/ECR.xlsx: open failed: EACCES (Permission denied)
I'm not sure why this is happening. Any help would be awesome! Thanks!
EDIT:
Here's my AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<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.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:dataExtractionRules="#xml/data_extraction_rules"
android:fullBackupContent="#xml/backup_rules"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.FRCScout22"
tools:targetApi="31">
<activity
android:name=".DropDownActivity"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
</application>
</manifest>

Related

Google Maps [API] view is gray on my mobile device

Hi guyes I really need your help.
I've read the instructions on how to use Google API on this link:
https://developers.google.com/maps/documentation/android/start
I've followed all seven steps but I couldn't display Google Map in my app.
[I have already got tired from trying to get the Emulator to work so I've decided to generate an APK file instead and send it to my smartphone]
After intalling the app, once I open it I can only see a grey screen and 'Google' signeture at the bottem left of the screen. that's all, nothing happens.
The app works fine when I connect my device and use the debug mode.
I've tried installing it Via the adb but it still didn't work.
I've been following many articles for the last three days regarding this issue but no matter what I've tried it just didn't work.
What am I doing wrong?
Here is my code:
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="josh.com.googlemapslast" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<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_FINE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps" >
<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.geo.API_KEY"
android:value="AIza**********"/>
</application>
</manifest>
Main Activity Java:
package josh.com.googlemap2;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
#Override
public void onMapReady(GoogleMap map) {
// Add a marker in Sydney, Australia, and move the camera.
LatLng sydney = new LatLng(-34, 151);
map.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
map.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
}
Main Activity Layout:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/map"
tools:context=".MapsActivity"
android:name="com.google.android.gms.maps.SupportMapFragment" />
Goole_Maps_api.xml
<string name="google_maps_key" translatable="false" templateMergeStrategy="preserve">
AIzaSyAnvkHr4CGYzmROT*******
</string>
</resources>
Alright, There are two things that you should note if you encounter a similar situation:
1) There are two google maps api.xml files, one for release and one for debug.
you can find them on these paths:
\app\src\release\res\values
\app\src\debug\res\values
Make sure to add your Google Map Key on both files!
2) I didn't find this information on official source but you need to generate another SHA1 key for the release file in addition to your regular SHA1 key.
You must have two SHA1 keys, one for the debug version and one for the release version.
Once you have the new key for the release file, add it to your Google API Console exisiting key at the second row.

"Error inflating class fragment" with google map on xamarin

I have xamarin for an android app. I would like an ActionBar with tabs and a google map on one tab.
It works but only one time when i click on the map tab.
I explain, the app launched, im on the event tab, i click on map tab, the map works correctly but when i go back to event tab and again map tab, it crash.
Main:
ActionBar.SetDisplayShowHomeEnabled (true);
ActionBar.SetDisplayShowHomeEnabled (true);
ActionBar.SetDisplayShowTitleEnabled (true);
ActionBar.SetTitle (Resource.String.app_name);
ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
SetContentView (Resource.Layout.Main);
var fragMap = new MapPageFragment();
ActionBar.Tab tab2 = ActionBar.NewTab();
tab2 = ActionBar.NewTab();
tab2.SetText("Map");
tab2.TabSelected += delegate(object sender, ActionBar.TabEventArgs e)
{
e.FragmentTransaction.Replace(Resource.Id.fragment_container, fragMap);
};
ActionBar.AddTab(tab2);
MapPageFragment:
namespace OnmappTest
{
public class MapPageFragment : Android.App.Fragment
{
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
// Use this to return your custom view for this Fragment
view = inflater.Inflate(Resource.Layout.MapPage, container, false);
The error
binary xml file line #1: error inflating class fragment" on "view =
inflater.Inflate(Resource.Layout.MapPage, container, false);
MapPage
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="350dp"
class="com.google.android.gms.maps.MapFragment" />
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="OnmappTest.OnmappTest">
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="21" />
<!-- Google Maps for Android v2 requires OpenGL ES v2 -->
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<!-- We need to be able to download map tiles and access Google Play Services-->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Allow the application to access Google web-based services. -->
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!-- Google Maps for Android v2 will cache map tiles on external storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Google Maps for Android v2 needs this permission so that it may check the connection state as it must download data -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application android:label="OnmappTest" android:icon="#drawable/icon">
<!-- Put your Google Maps V2 API Key here. -->
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="value" />
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
</application>
I tried SupportMapFragment instead of MapFragment, FragmentActivity instead of Fragment but nothing
I had the same problem. Please add this to OnPause method:
protected override void OnPause()
{
base.OnPause();
if (_mapFragment != null)
{
FragmentManager fragmentManager = FragmentManager;
fragmentManager.BeginTransaction().Remove(_mapFragment).Commit();
}
}
This solved my problem, hope that will solve yours.

Adding a map to a class

Hello I would like to add a map (static image) to a page. I will try to explain what I have done so far and what my problem is as good as I can in case someone else has the same problem in the future.
I have done the following:
1. Updated the Manifest file with permissions/API (got the API (from Google API Console) key using the SHA1 from Eclipse using Window > Preferences > Build
2. Updated the XML file of the class where the map will be added
3. Added some Java code into the classes Java file
Below is the Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.learn2develop.lapmaster"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/lapmaster_icon"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="net.learn2develop.lapmaster.LapMasterActivity"
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:label="Logged In"
android:name=".UserLoggedInScreen" >
<intent-filter >
<action android:name="net.learn2develop.UserLoggedInScreen" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:label="Track Listing"
android:name=".ListOfCircuits" >
<intent-filter >
<action android:name="net.learn2develop.ListOfCircuits" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:label="Snetterton"
android:name=".Snetterton" >
<intent-filter >
<action android:name="net.learn2develop.Snetterton" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!-- Other activities -->
<!-- Google Play Services -->
<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="Various" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<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" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
</application>
</manifest>
Below is the class 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"
android:name="com.google.android.gms.maps.SupportMapFragment" />
Below is the class Java:
import android.app.Activity;
import android.os.Bundle;
import com.google.android.gms.maps.SupportMapFragment;
public class Snetterton extends Activity
{
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.snetterton);
SupportMapFragment map = ((SupportMapFragment)
.getSupportFragmentManager().findFragmentById(R.id.map))
.getMap();
}
}
As you can probably guess from my code I am creating an app for race tracks. In the class called Snetterton I want to add a picture (Google maps) of Snetterton.
To get to this page the user:
1. Starts at a login screen (LapMasterActivity)
2. Is greeted with a home page (UserLoggedInScreen)
3. Goes to a page with a list of tracks (for now it is just Snetterton) (ListOFTracks)
4. When the user clicks the button for Snetterton it takes them to the Snetterton class' page where I would like the map. (Snetterton).
In my code only ((SupportMapFragment) is underlined.
Thanks.
Answered this myself (eventually):
Code I used is:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/relativeLayoutFragment"
android:layout_width="match_parent"
android:layout_height="fill_parent" >
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
public class TopGear extends Activity
{
private GoogleMap aMap;
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.top_gear);
aMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
aMap.getUiSettings().setAllGesturesEnabled(false);
LatLng topGearTrack = new LatLng(51.116492, -0.541767);
aMap.setMyLocationEnabled(true);
aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(topGearTrack, 15));
aMap.addMarker(new MarkerOptions()
.title("Top Gear")
.snippet("Welcome to the famous Top Gear circuit.")
.position(topGearTrack));
aMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
setUpMapIfNeeded();
}
public void setUpMapIfNeeded()
{
//Do a null check to confirm that we have not already instantiated the map.
if (aMap == null)
{
aMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
//Check if we were successful in obtaining the map.
if (aMap != null)
{
//The Map is verified. It is now safe to manipulate the map.
}
}
}
}

ServiceStack not rendering Razor Views. Just seeing Snapshot. Config wrong?

Note: This question while similar to this one however it's about different issues.
It seems for whatever reason ServiceStack is not running/compiling Razor views and seems like a config issue however RazorRockstarts runs fine.
I'm using ServiceStack 4.0.11 and have compared against RazorRockstars runnning ServiceStack 4.0.8
In VS2013 I have created a new ASP.NET Website (Empty)
Install-Package ServiceStack
Install-Package ServiceStack.Razor
Added httpHandlers to web.config
Created AppHost and .Init() in Global.asax Application_Start.
AppHost.LoadPlugin(new RazorFormat());
Created /Services/HomeService.cs (inherited from ServiceStack.Service)
Created Home route in HomeService
Created /Views/Home/Home.cshtml
I run in debug on VS 2013 and all I get is the ServiceStack snapshot when going to /home. What am I missing?
/AppHost.cs
using Funq;
using ServiceStack;
using ServiceStack.Razor;
namespace SSTest
{
public class AppHost : AppHostBase
{
public AppHost() : base("SSTest", typeof(AppHost).Assembly) { }
public override void Configure(Container container)
{
LoadPlugin(new RazorFormat());
}
public static void Start()
{
new AppHost().Init();
}
}
}
/Global.asax
protected void Application_Start(object sender, EventArgs e)
{
AppHost.Start();
}
/Services/HomeService.cs
using ServiceStack;
namespace SSTest.Services
{
[Route("/home")]
public class Home
{
public string Name { get; set; }
}
[DefaultView("Home")]
public class HomeServices : Service
{
public object Get(Home request)
{
return new Home(){Name = "Here's home!"};
}
}
}
/Views/Home/Home.cshtml
#{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Home</title>
</head>
<body>
<div>
<h1>This is home!!</h1>
</div>
</body>
</html>
/Web.config
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web>
<httpHandlers>
<add path="*" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" />
</httpHandlers>
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
<buildProviders>
<add extension=".cshtml" type="ServiceStack.Razor.CSharpRazorBuildProvider, ServiceStack.Razor" />
</buildProviders>
</compilation>
<httpRuntime targetFramework="4.5" />
</system.web>
<!-- Required for IIS 7.0 -->
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add path="*" name="ServiceStack.Factory" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
</handlers>
</system.webServer>
<appSettings>
<add key="webPages:Enabled" value="false" />
</appSettings>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="ServiceStack.Razor.ViewPage">
<namespaces>
<add namespace="ServiceStack" />
<add namespace="ServiceStack.Html" />
<add namespace="ServiceStack.Razor" />
<add namespace="ServiceStack.Text" />
<add namespace="ServiceStack.OrmLite" />
<add namespace="SSTest" />
<add namespace="SSTest.Services" />
</namespaces>
</pages>
</system.web.webPages.razor>
</configuration>
I know mythz has solved your problem, but something else to check for future readers with the same problem:
Make sure your *.cshtml files are copied to the output directory. For whatever reason, mine weren't, thus ServiceStack couldn't find them and all I got was the snapshot like yourself.
I'm not sure if this is related to using a self-hosted console application instead of a web project.
Inside Configure() plugins should be loaded with:
Plugins.Add(new RazorFormat());
In ServiceStack.Razor Layout = null, suggests to use the default layout template Views\_Layout.cshtml, you can choose not use any template with Layout="" instead.
If you don't have OrmLite installed then you want to remove the ServiceStack.OrmLite namespace from being included in all Razor pages by removing it from your Web.config:
<add namespace="ServiceStack.OrmLite" />
Your view should be located in /Views/Home.cshtml instead of /Views/Home/Home.cshtml.
I was having the exact same issue! With the current ServiceStack VS template (as of April 1, 2015 and no this isn't an April Fools joke!), the following line will mess things up if you're running a self-hosted service:
WebHostPhysicalPath = Path.GetFullPath(Path.Combine("~".MapServerPath(), "..", "..")),
This is within your AppHost.cs file inside of the Configure(Container) function within the SetConfig(new HostConfig { /* ... here ... */ } ); block.
Comment out the entire WebHostPhysicalPath = ... line and re-run your application.
A better fix than simply commenting it out is to set the correct directory which is either your actual bin directory via:
WebHostPhysicalPath = Path.GetFullPath("~".MapServerPath()),
Or, if you have a specific build architecture (ie. x86 or x64 instead of AnyCPU), you likely have a third layer of folders. So change the WebHostPhysicalPath to this:
WebHostPhysicalPath = Path.GetFullPath(Path.Combine("~".MapServerPath(), "..", "..", "..")),

The description com.google.android.gms.play-services.4.2.42 is invalid

Android studio - googgle maps api v2 using these links:
https://developers.google.com/maps/documentation/android/start#getting_the_google_maps_android_api_v2
Google Maps in Android Studio
messages gradle tasks:
A problem occurred evaluating project ':app'.
> The description com.google.android.gms.play-services.4.2.42 is invalid
Event log:
3:29:53 PM Gradle invocation completed successfully with 1 error(s) in 6 sec
3:29:56 PM Gradle 'MyApplication2' project refresh failed:
The description com.google.android.gms.play-services.4.2.42 is invalid
Gradle settings
in my build.gradle file
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 13
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.android.gms.play-services.4.2.42'
I found this version number from .....sdk\extras\google\google_play_services\libproject\google-play-services_lib\AndroidManifest.xml file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.gms"
android:versionCode="4242030"
android:versionName="4.2.42 (1018832-030)" >
<uses-sdk android:minSdkVersion="9"/>
</manifest>
and if it helps...manifest
<?xml version="1.0" encoding="utf-8"?>
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="19" />
<permission
android:name="com.android.test.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<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" />
<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-feature
android:glEsVersion="0x00020000"
android:required="true" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.android.myapplication2.app.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="my key"/>
</application>
Instead of:
compile 'com.google.android.gms.play-services.4.2.42'
You need:
compile 'com.google.android.gms:play-services:4.2.42'