MapActivity / MapView causes application to crash at startup

by bw » Mon, 10 Nov 2008 10:33:26 GMT


Sponsored Links
 Hi,

I'm trying to create a new application with a MapView.
When I first create a new Android project in Eclipse, I run it in the
emulator and get the expected "Hello, [project name]" message.
Then, I try changing "Activity" to "MapActivity" and adding a MapView
(I've tried both the xml and the code route):


public class MyMap extends MapActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        MapView mMapView = new MapView(this, "my_map_api_key");
        mMapView.setClickable(true);
        mMapView.setEnabled(true);
        mMapView.setSatellite(true);
        setContentView(mMapView);

    }


        @Override
        protected boolean isRouteDisplayed() {
                // TODO Auto-generated method stub
                return false;
        }
}


However, when I run this in the emulator, it immediately crashes with
the "Application has stopped unexpectedly" error. The debugger shows
this error:


Thread [<3> main] (Suspended (exception RuntimeException))
        ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord)
line: 2068
        ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord)
line: 2156
        ActivityThread.access$1800(ActivityThread, ActivityThread
$ActivityRecord) line: 112
        ActivityThread$H.handleMessage(Message) line: 1580
        ActivityThread$H(Handler).dispatchMessage(Message) line: 88
        Looper.loop() line: 123
        ActivityThread.main(String[]) line: 3742
        Method.invokeNative(Object, Object[], Class, Class[], Class, int,
boolean) line: not available [native method]
        Method.invoke(Object, Object...) line: 515
        ZygoteInit$MethodAndArgsCaller.run() line: 739
        ZygoteInit.main(String[]) line: 497
        NativeStart.main(String[]) line: not available [native method]


I know I'm making some stupid mistake.. but I can't figure it out.

-Ben
--~--~---------~--~----~------------~-------~--~----~



MapActivity / MapView causes application to crash at startup

by bw » Mon, 10 Nov 2008 11:13:16 GMT


 Got it..

"This is not a standard package in the Android library. In order to
use it, you must add the following XML element, as a child of the
application  element, in your AndroidManifest.xml file:

<uses-library android:name="com.google.android.maps" />


From:

 http://code.google.com/android/toolbox/apis/lbs.html 

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


MapActivity / MapView causes application to crash at startup

by bw » Mon, 10 Nov 2008 11:44:08 GMT


 Also had to add

<uses-permission android:name="android.permission.INTERNET" />

above my application tag.

(Source:



MapActivity / MapView causes application to crash at startup

by Frank Trollmann » Tue, 11 Nov 2008 00:10:08 GMT


 Hi

You might want to look here:

 http://zackola.com/blog/2008/10/26/android-mapview-permissions-and-prerequisites/ #comment-227

this site subsumes (hopefully) all permissions and prerequisites
needed for the MapView.

- Frank

--~--~---------~--~----~------------~-------~--~----~



MapActivity / MapView causes application to crash at startup

by Billsen » Tue, 11 Nov 2008 03:15:23 GMT


 You need to generate a key for apikey for your emulator since Google
has started to enforce the rule to put real key in xml file.



> (Source:



MapActivity / MapView causes application to crash at startup

by Dagger » Wed, 19 Nov 2008 15:24:51 GMT


 I am having the same problem but I am only implementing the Activity
Class which is included in the package by default.
THis is the partial code.

public class ActiveOctave extends Activity implements OnErrorListener,
        OnBufferingUpdateListener, OnCompletionListener,
        OnPreparedListener, SurfaceHolder.Callback {

        private static final String TAG = "VideoPlayer";
    private MediaPlayer mp;
    private SurfaceView mPreview;
    private EditText mPath;
    private SurfaceHolder holder;
    private ImageButton mPlay;
    private ImageButton mPause;
    private ImageButton mReset;
    private ImageButton mStop;
    private String current;
    /**
     * Called when the activity is first created.
     */
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.main);
        // Set up the play/pause/reset/stop buttons
        mPreview = (SurfaceView) findViewById(R.id.surface);
        mPath = (EditText) findViewById(R.id.path);
        mPlay = (ImageButton) findViewById(R.id.play);
        mPause = (ImageButton) findViewById(R.id.pause);
        mReset = (ImageButton) findViewById(R.id.reset);
        mStop = (ImageButton) findViewById(R.id.stop);

This is my Debug Stack.
Thread [<3> main] (Suspended (exception RuntimeException))
        ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord)
line: 2131
        ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord)
line: 2147
        ActivityThread.access$1800(ActivityThread, ActivityThread
$ActivityRecord) line: 112
        ActivityThread$H.handleMessage(Message) line: 1572
        ActivityThread$H(Handler).dispatchMessage(Message) line: 88
        Looper.loop() line: 123
        ActivityThread.main(String[]) line: 3708
        Method.invokeNative(Object, Object[], Class, Class[], Class, int,
boolean) line: not available [native method]
        Method.invoke(Object, Object...) line: 492
        ZygoteInit$MethodAndArgsCaller.run() line: 734
        ZygoteInit.main(String[]) line: 492
        NativeStart.main(String[]) line: not available [native method]

Please help what to Do.





> > (Source:



MapActivity / MapView causes application to crash at startup

by Alemao » Wed, 10 Dec 2008 03:40:51 GMT


 I'm also having the same issue. I even tried a very simple example
from Android's documentation ( http://code.google.com/android/samples/ 
ApiDemos/src/com/example/android/apis/view/MapViewDemo.html) but the
result is the same: "Application has stopped unexpectedly".

I added all the permissions ( http://zackola.com/blog/2008/10/26/ 
android-mapview-permissions-and-prerequisites/#comment-227) and also
the lib access ( http://code.google.com/android/toolbox/apis/lbs.html ),
but the application still crashes.

What I did is simply to create a "new Android activity" and replace
the default code to the one from Android's documentation, then I added
the permissions to the Manifest.xml file. Am I missing something? Does
anybody know why I can't start a MapActivity?

--~--~---------~--~----~------------~-------~--~----~



MapActivity / MapView causes application to crash at startup

by Aldo Neto » Wed, 10 Dec 2008 03:53:25 GMT


 Never mind. I was adding the LIB in the wrong place of the Manifest.XML
file.
Thanks anyway.






--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Android 2.2 Froyo Berjalan di Nokia N90

baru baca di 
detik<http://www.detikinet.com/read/2010/06/28/115735/1388210/317/android-22-froyo-berjalan-di-nokia-n900/?i991102105>


OS Android yang berjalan dengan Nokia N900 bukanlah kejutan baru. Hal
tersebut pernah dilakukan grup bernama NTDroid project. Kini mereka pun
berhasil membenamkan versi terbaru Android 2.2 Froyo, dalam N900.

Dikabarkan sebelumnya, berdasarkan uji benchmark oleh Android Police, Froyo
dapat berlari empat kali lebih kencang dibanding Eclair alias Android 2.1.
Apakah ini berarti lebih kencang dari OS Maemo? Ternyata tidak.

Dalam video 
tersebu<http://www.youtube.com/watch?v=U46e_VYANWs&feature=player_embedded>t
diketahui Froyo yang menggunakan *kernel version* *2.6.28-omap1
e-...@maemo-sdk #33,* nampak sedikit lambat ketimbang Maemo.

Selain itu, tak semua fitur Froyo berjalan mulus pada Nokia N900. Dalam demo
video di YouTube, Froyo yang berjalan pada ponsel Maemo tersebut tak mampu
mendeteksi status baterai, nomor ponsel, serta jaringan.

Untuk urusan suara, Froyo sudah dapat berjalan mulus di N900, termasuk saat
menggunakan earphone. Namun untuk opsi setting, rupanya N900 terkesan
'menolak' kehadiran Froyo.

*"Sorry! The Application Settings (process com.android.settings) has stopped
unexpectedly. Please try again,"* tulis pesan yang muncul pada layar ponsel,
saat dicek *detikINET *dalam video tersebut, Senin (28/6/2010). Alhasil N900
tidak bisa disetting lebih lanjut, melalui menu setting
aplikasi. Kesimpulannya Froyo sudah dapat berjalan pada N900. Hanya saja
jalannya kurang 'ikhlas'.

-- 
"Indonesian Android Community [id-android]" 

2. Issue in downloading Android Sourc

Hi all,

I have tried to download the android source in my Ubuntu 9.04 (kernel
version 2.6.28-11-generic). I have followed the steps mentioned in the
site (http://source.android.com/source/download.html) to download. But
when i tried to initialize the 'repo' with the latest version of
repository using the command (repo init -u 
git://android.git.kernel.org/platform/manifest.git),
i am getting the following error.

--------------------------------<Error Msg Snip
begin>--------------------------------------

r...@testpc-linux:~/bin/mydroid#repo init -u 
git://android.git.kernel.org/platform/manifest.git
gpg: keyring `/root/.repoconfig/gnupg/secring.gpg' created
gpg: keyring `/root/.repoconfig/gnupg/pubring.gpg' created
gpg: /root/.repoconfig/gnupg/trustdb.gpg: trustdb created
gpg: key 920F5C65: public key "Repo Maintainer
<r...@android.kernel.org>" imported
gpg: Total number processed: 1
gpg:               imported: 1

Getting repo ...
   from git://android.git.kernel.org/tools/repo.git
android.git.kernel.org[0: 204.152.191.45]: errno=Connection timed out
android.git.kernel.org[0: 130.239.17.12]: errno=Connection timed out
android.git.kernel.org[0: 149.20.20.141]: errno=Connection timed out
android.git.kernel.org[0: 199.6.1.176]: errno=Connection timed out
fatal: unable to connect a socket (Connection timed out)
r...@testpc-linux:~/bin/mydroid#

-----------------------------------<Snip
End>----------------------------------------------

I have pinged all the ip address shown in the error message, but it
fails. I would appreciate any help to resolve this problem.

FYI: The steps that i have followed to download the Android Source is
attached inline.

Thanks in advance,
Arun


Steps followed to download the Android source:
======================================

1. Install the Packages (Git, JDK, flex, bison, gperf, libsdl-dev,
libesd0-dev, libwxgtk2.6-dev, build-essential, zip, curl) using the
follwing command
      r...@testpc-linux:~# sudo apt-get install git-core gnupg sun-
java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev
build-essential zip curl libncurses5-dev zlib1g-dev

2. Install Valgrind using the following command.
      r...@testpc-linux:~# sudo apt-get install valgrind

3. Install Repo with the following commands.
      r...@testpc-linux:~# cd ~
      r...@testpc-linux:~# mkdir bin
      r...@testpc-linux:~# echo $PATH
      r...@testpc-linux:~# curl http://android.git.kernel.org/repo >~/
bin/repo
      r...@testpc-linux:~# chmod a+x ~/bin/repo

4. Initialize a Repo client with the following commands
      r...@testpc-linux:~/bin# mkdir mydroid
      r...@testpc-linux:~/bin/mydroid# cd mydroid
      r...@testpc-linux:~/bin/mydroid# repo init -u
git://android.git.kernel.org/platform/manifest.git
                gpg: keyring `/root/.repoconfig/gnupg/secring.gpg' created
                gpg: keyring `/root/.repoconfig/gnupg/pubring.gpg' created
                gpg: /root/.repoconfig/gnupg/trustdb.gpg: trustdb created
                gpg: key 920F5C65: public key "Repo Maintainer
<r...@android.kernel.org>" imported
                gpg: Total number processed: 1
                gpg:               imported: 1

                Getting repo ...
                   from git://android.git.kernel.org/tools/repo.git
                android.git.kernel.org[0: 204.152.191.45]: errno=Connection 
timed
out
                android.git.kernel.org[0: 130.239.17.12]: errno=Connection 
timed out
                android.git.kernel.org[0: 149.20.20.141]: errno=Connection 
timed out
                android.git.kernel.org[0: 199.6.1.176]: errno=Connection timed 
out
                fatal: unable to connect a socket (Connection timed out)
      r...@testpc-linux:~/bin/mydroid#





-- 
unsubscribe: android-kernel+unsubscr...@googlegroups.com
website: 

3. Issues in downloading android source code(Repo init )

4. Lenovo LePhone

5. OOT: ada yang pernah dapet email seperti ini?

6. How to fetch phone's phone number or unique ID

7. Docstogo