1

I am trying to develop Android app, something with GPS, and using Google Maps API v2. This error (bigger picture in link) is showing up and app crashes immidiately after run.

link to image

And here's the AndroidManifest.xml file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.bajo.moj.gpsreminder" >
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="19" />

    <!-- dobivanje douštenja za MAPE -->
    <permission
        android:name="com.bajo.moj.gpsreminder.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"/>
    <uses-permission android:name="com.bajo.moj.gpsreminder.MAPS_RECEIVE"/>


    <!-- doupuštenje za Internet, vanjsku pohranu i ostalo-->
    <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.gfs.permission.READ_GSERVICES"/>

    <!-- nije potrebno za Google Maps API v2, ali je recommended -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>


    <!-- OpenGL verzija 2.0 za renderanje screen-a -->
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>


<application
    android:debuggable="true"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <!-- kljuc od Google-a -->
    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="AIzaSyCV9Plzy-RcaJ30cnXw_jRgXjg5czLIS9A"/>

    <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>

</application>

</manifest>

//Also, I am using 2 Java Activities like below: -> I am not. enter image description here

phantom
  • 57
  • 1
  • 1
  • 7

1 Answers1

0

I am using 2 Java Activities like below

Did you say you have two activities? If so, you haven't declared one of them in the manifest file.

Axiom
  • 88
  • 1
  • 6
  • I did added second Activity in AndroidManifest.xml. [link](http://i.imgur.com/3kDMa1e.png) But it's underlined red and now I cannot run app on my device. – phantom May 11 '15 at 19:03
  • I see. But your manifest file doesn't show that though. There's only the MainActivity declared in that file or at least in the picture. – Axiom May 11 '15 at 19:03
  • Can you please take a snapshot of the LocationProvider class' code? – Axiom May 11 '15 at 19:06
  • LocationProvider is not an activity. That's why you get that red line under its name in your manifest. – Axiom May 11 '15 at 19:11
  • So I should delete But why do I get error posted in first post? – phantom May 11 '15 at 19:13
  • You should definitely delete . As for your original error, could you please post the code of your main activity too? – Axiom May 11 '15 at 19:14
  • OK, I deleted code from AndroidManifest.xml. [Here is MainActivity.](http://pastebin.com/xtmffYSv) Also, [here](http://pastebin.com/PRSvS7nn) is complete error that is showing up all the time. – phantom May 11 '15 at 19:18
  • So, do you have a fragment tag in your activity_main.xml file with the id: map? (R.id.map) – Axiom May 11 '15 at 19:22
  • I do, but I get [this error](http://i.imgur.com/GhhJ3pU.png), not sure if that's relevant... – phantom May 11 '15 at 19:29
  • Hmm .. base on your error: at com.bajo.moj.gpsreminder.MainActivity.setUpMapIfNeeded(MainActivity.java:67) it seems like it can't find that fragment. – Axiom May 11 '15 at 19:30
  • Here is also [Text view](http://i.imgur.com/cYp3a2F.png). I'm not sure how to solve this problem, as I think that I added fragment with id: map... – phantom May 11 '15 at 19:32
  • So, you should move android:text="@string/hello_world" inside the textView tag. – Axiom May 11 '15 at 19:38
  • OK, I [did](http://i.imgur.com/9snP1Lo.png). Do you maybe have some other solution why the app still crashes? – phantom May 11 '15 at 19:41
  • It's OK. Thank you for trying! If anyone else know what's may be the problem and how to solve it, please help. Here's the [latest error](http://pastebin.com/a46t3uCA). App still crashes when I try to run it. – phantom May 11 '15 at 19:50