为什么Android程序无法在我的手机上运行(它可以在虚拟手机上正常运行)

时间:2020-02-20 11:43:17

标签: java android kotlin

 try {
        val adresstext= findViewById(R.id.editText3)as TextView

        fusedLocationClient = LocationServices.getFusedLocationProviderClient(this)
        fusedLocationClient.lastLocation.addOnSuccessListener {
                location -> location

            var locationx=location.longitude
            var locationy=location.latitude

            val name = findViewById(R.id.textView) as TextView
            name.text=(locationx.toString()+" "+locationy.toString())
            var geocoder: Geocoder
            var listadress :List<Address>


            geocoder = Geocoder(this, Locale.getDefault());
            listadress =geocoder.getFromLocation(locationy,locationx,1)
            var adress=listadress[0].getAddressLine(0)
            var city =listadress[0].locality.get(0)
            var state = listadress[0].adminArea.get(0)
            var country = listadress[0].getCountryName()
            var postalCode = listadress[0].getPostalCode()
            var knownName = listadress[0].getFeatureName()
            adresstext.text=(adress+city+state+country+postalCode+knownName)


        }

    }
    catch (e: java.lang.Exception)
    {
        Toast.makeText(this,e.toString(),Toast.LENGTH_LONG).show()
    }

那是我的代码, 当我在模拟器中运行它时,它运行正常,没有错误 但是当我用手机(将其连接到我的电脑)运行它时,该按钮不起作用,它说:

V/AudioManager: querySoundEffectsEnabled...
D/AwareBitmapCacher: handleInit switch not opened pid=19134

在程序在我的手机中打开之前,运行提示就像:

E/: APS:IFLoad:importExternalFunctions, search function createNewHwApsUtils failed, dlsym err:undefined symbol: createNewHwApsUtils

E/AwareLog: AtomicFileUtils: readFileLines file not exist: android.util.AtomicFile@6c8edde
E/AwareLog: AtomicFileUtils: readFileLines file not exist: android.util.AtomicFile@3bb1bbf

这3个都是红色的,我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

您应该进入电话设置并找到您的应用程序。检查位置服务是否被允许。如果不允许。接受。