当前位置: 首页 > 知识库问答 >
问题:

Android应用程序崩溃时,它创建一个折线

梁磊
2023-03-14

每当它试图创建一条线时就会崩溃。我想用PathOverlay,但已经不推荐了。我想画一条线。

public void drawLine(){
    List<GeoPoint> track = new ArrayList<>();
    track.add(new GeoPoint(14.4889,121.0325));
    track.add(new GeoPoint(14.4906,121.0353));

    Polyline roadOverlay = new Polyline(map.getContext());
    roadOverlay.setPoints(track);
    map.getOverlays().add(roadOverlay);
    map.invalidate();
}

梯度控制台

正在执行任务“:app:validateSigningDebug”(最新检查耗时0.0秒),原因是:任务尚未声明任何输出:app:validateSigningDebug(线程[Daemon worker Thread 2,5,main])已完成。花了0.022秒:应用程序:packageDebug(线程[Daemon worker Thread 2,5,main])已启动:app:packageDebug执行任务”:app:packageDebug(最新检查耗时0.067秒),原因是:输入文件C:\Users\hp\AndroidStudioProjects\path\app\build\intermediates\transforms\dex\debug\folders\1000\5\slice\u 3\classes。德克斯变了app:packageDebug(线程[Daemon worker Thread 2,5,main])已完成。耗时6.165秒:应用程序:buildInfoGeneratorDebug(线程[Daemon worker Thread 2,5,main])已启动:app:buildInfoGeneratorDebug执行任务”:app:buildInfoGeneratorDebug(最新检查耗时0.0秒),原因是:任务尚未声明任何输出:应用程序:buildInfoGeneratorDebug(线程[Daemon worker线程2,5,main])已完成。花了0.043秒:应用程序:CompiledBugSources(线程[Daemon worker Thread 2,5,main])已启动:app:CompiledBugSources正在跳过任务“:app:CompiledBugSources”,因为它没有任何操作:app:CompiledBugSources(线程[Daemon worker线程2,5,main])已完成。花了0.001秒:app:assembleDebug(线程[Daemon worker Thread 2,5,main])已启动:app:assembleDebug跳过任务“:app:assembleDebug”,因为它没有任何操作:app:assembleDebug(线程[Daemon worker Thread 2,5,main])已完成。花了0.001秒。

我想这会有帮助吗?我的osmdroid磁贴位于手机存储器中:

$ adb shell am start -n 
"com.example.mariel.paths/com.example.mariel.paths.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Connected to process 20345 on device lge-lg_x155-YL7PVWCE99999999
V/ActivityThread: ActivityRecord{1795043f token=android.os.BinderProxy@3978310c {com.example.mariel.paths/com.example.mariel.paths.MainActivity}}: app=android.app.Application@15416c6a, appName=com.example.mariel.paths, pkg=com.example.mariel.paths, comp={com.example.mariel.paths/com.example.mariel.paths.MainActivity}, dir=/data/app/com.example.mariel.paths-1/base.apk
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
W/art: Suspending all threads took: 6.790ms
I/OsmDroid: Using tile source: Mapnik
D/Environment: getStorageVolume,  volume:StorageVolume:
                   mStorageId=65537 mPath=/storage/emulated/0 mDescriptionId=17040786 
                   mPrimary=true mRemovable=false mEmulated=true mMtpReserveSpace=10 
                   mAllowMassStorage=false mMaxFileSize=0 mOwner=UserHandle{0} mUuid=null 
                   mUserLabel=null mState=mounted 
D/Environment: getStorageVolume,  volume:StorageVolume:
                   mStorageId=131073 mPath=/storage/sdcard1 mDescripthtml" target="_blank">ionId=17040784 
                   mPrimary=false mRemovable=true mEmulated=false mMtpReserveSpace=0 
                   mAllowMassStorage=true mMaxFileSize=0 mOwner=null mUuid=0000-CCCC 
                   mUserLabel=KFAT1 mState=mounted 
D/Environment: getStorageVolume,  volume:StorageVolume:
                   mStorageId=196609 mPath=/storage/usbotg mDescriptionId=17040787 
                   mPrimary=false mRemovable=true mEmulated=false mMtpReserveSpace=0 
                   mAllowMassStorage=false mMaxFileSize=0 mOwner=null mUuid=null 
                   mUserLabel=null mState=removed 
I/OsmDroid: sdcard state: mounted
D/Environment: getStorageVolume,  volume:StorageVolume:
                   mStorageId=65537 mPath=/storage/emulated/0 mDescriptionId=17040786 
                   mPrimary=true mRemovable=false mEmulated=true mMtpReserveSpace=10 
                   mAllowMassStorage=false mMaxFileSize=0 mOwner=UserHandle{0} mUuid=null 
                   mUserLabel=null mState=mounted 
D/Environment: getStorageVolume,  volume:StorageVolume:
                   mStorageId=131073 mPath=/storage/sdcard1 mDescriptionId=17040784 
                   mPrimary=false mRemovable=true mEmulated=false mMtpReserveSpace=0 
                   mAllowMassStorage=true mMaxFileSize=0 mOwner=null mUuid=0000-CCCC 
                   mUserLabel=KFAT1 mState=mounted 
D/Environment: getStorageVolume,  volume:StorageVolume:
                   mStorageId=196609 mPath=/storage/usbotg mDescriptionId=17040787 
                   mPrimary=false mRemovable=true mEmulated=false mMtpReserveSpace=0 
                   mAllowMassStorage=false mMaxFileSize=0 mOwner=null mUuid=null 
                   mUserLabel=null mState=removed 
I/OsmDroid: sdcard state: mounted
D/Environment: getStorageVolume,  volume:StorageVolume:
                   mStorageId=65537 mPath=/storage/emulated/0 mDescriptionId=17040786 
                   mPrimary=true mRemovable=false mEmulated=true mMtpReserveSpace=10 
                   mAllowMassStorage=false mMaxFileSize=0 mOwner=UserHandle{0} mUuid=null 
                   mUserLabel=null mState=mounted 
D/Environment: getStorageVolume,  volume:StorageVolume:
                   mStorageId=131073 mPath=/storage/sdcard1 mDescriptionId=17040784 
                   mPrimary=false mRemovable=true mEmulated=false mMtpReserveSpace=0 
                   mAllowMassStorage=true mMaxFileSize=0 mOwner=null mUuid=0000-CCCC 
                   mUserLabel=KFAT1 mState=mounted 
D/Environment: getStorageVolume,  volume:StorageVolume:
                   mStorageId=196609 mPath=/storage/usbotg mDescriptionId=17040787 
                   mPrimary=false mRemovable=true mEmulated=false mMtpReserveSpace=0 
                   mAllowMassStorage=false mMaxFileSize=0 mOwner=null mUuid=null 
                   mUserLabel=null mState=removed 
I/OsmDroid: sdcard state: mounted
I/art: Background sticky concurrent mark sweep GC freed 2440(204KB) AllocSpace objects, 0(0B) LOS objects, 17% free, 1462KB/1770KB, paused 5.950ms total 21.482ms
D/BONUSPACK: OSRMRoadManager.getRoads:http://router.project-osrm.org/route/v1/driving/121.0325,14.4889;121.03529999999999,14.490599999999999?alternatives=false&overview=full&steps=true
D/libc-netbsd: [getaddrinfo]: hostname=router.project-osrm.org; servname=(null); cache_mode=(null), netid=0; mark=0
D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
D/ActivityThread: ACT-LAUNCH_ACTIVITY handled : 0 / ActivityRecord{1795043f token=android.os.BinderProxy@3978310c {com.example.mariel.paths/com.example.mariel.paths.MainActivity}}
D/ActivityThread: ACT-PAUSE_ACTIVITY_FINISHING handled : 0 / android.os.BinderProxy@3978310c
W/art: Suspending all threads took: 7.461ms
D/ActivityThread: ACT-DESTROY_ACTIVITY handled : 1 / android.os.BinderProxy@3978310c
W/art: Suspending all threads took: 7.023ms

共有1个答案

于鸿博
2023-03-14

尝试删除地图。使无效。。我猜在onCreate中不需要它,因为在onCreate存在后将生成视图。

 类似资料:
  • 在以前的代码上,谁医生帮了我 现在,android应用程序在我的手机上运行时崩溃了,这是错误日志 第一个问题是在我用相机扫描二维码后,它不能显示在二维码的结果进入 第二个问题是,我从存储器中选择了一个QRcode图像,然后点击确认,它崩溃了 下面是我认为的问题 类型不匹配:推断的类型是Uri?但乌里是意料之中的 冗余SAM构造函数 'onRequestPermissionsResult(Int,数

  • 我正在从导入geoJSON数据。jsons文件。它在某些文件上工作得很好,但在其他文件上就不行了。我认为我的文件有问题,但我在geojson lint和geojson.io上测试了它们,没有问题。 这是堆栈: 这是我非常简单的代码 这是我的一个JSON导致了这个错误 build.gradle(项目)和build.gradle(应用程序) 欢迎任何想法

  • 经过几天的计划,我刚刚开始为我的聊天应用程序编写一些代码,但问题是,在Gradle Build完成并将应用程序安装在我的设备上之后,它一直在崩溃。我创建了一个预计会打开新活动的按钮,但它没有这样做,而是崩溃了。在我编写任何代码之前,一切都正常,应用程序打开,logcat没有显示任何错误。以下是错误: 我试着遵循其他一些建议,但都不起作用。以下是我的代码片段: }

  • 我正在使用内置于Web View的Android开发浏览器。其中我面临的一个问题是,当我访问http://crashmybrowser.com测试浏览器上的选项卡崩溃时,我的整个浏览器应用程序都会崩溃。但是,当在chrome或Opera上进行相同的测试时,这些浏览器会在崩溃中幸存下来,并且只有特定的选项卡崩溃是由于访问上述网站而预期的结果。有人能帮助理解我如何在使用Webview的浏览器上处理此崩

  • 我正在尝试将图像添加到我新创建的应用程序中。但是,当我运行我的应用程序时,它会崩溃。我没有在我的应用程序中编写任何代码,因此我提供了XML代码和错误日志。我在以前的应用程序中使用了ImageViews。没有错误。我已经优化了我的图像,但它仍然给我错误。 图像详细信息 错误日志: 09-08 16:03:02.266 15137-15137/ooper.loopE/AndroidRuntime: F

  • 我正在使用这段代码向日历添加一个新事件。 当这段代码运行时,它似乎一点都不出错。然而,当我使用默认的Android日历应用程序打开日历时,当我试图查看添加的事件时,它会崩溃。 这是值的转储 01-15 22:39:47.561:I/System.out(25804):值:CALENDAR_ID=2 EventLocation=FNDN title=DNDBDB DTSTART=1421386255