当我通过仿真器调试时,它正在运行,但是在构建apk后崩溃,我试图禁用即时日志,请帮助我,我在这里停留了2天 在模拟器上,该应用程序运行正常,但在构建APK并在另一台设备上安装后崩溃了!
menefist:`
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".lovecalculate"
android:label="@string/app_name"/>
<activity android:name=".quoteforlove" />
<activity android:name=".quotestoimpress"></activity>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-8811619328046225~9370277426"/>
</application>
main activity :
class MainActivity : AppCompatActivity() {
private lateinit var mInterstitialAd: InterstitialAd
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
MobileAds.initialize(this, "ca-app-pub-8811619328046225~9370277426")
mInterstitialAd = InterstitialAd(this)
mInterstitialAd.adUnitId = "ca-app-pub-8811619328046225/8896005838"
mInterstitialAd.loadAd(AdRequest.Builder().build())
val btn = findViewById<View>(R.id.btnlovecal) as Button
btn.setOnClickListener {
if (mInterstitialAd.isLoaded) {
mInterstitialAd.show()
} else {
startActivity(Intent(this@MainActivity,lovecalculate::class.java))
}}
val btn1 = findViewById<View>(R.id.btnquote) as Button
btn1.setOnClickListener {
if (mInterstitialAd.isLoaded) {
mInterstitialAd.show()
} else {
startActivity(Intent(this@MainActivity,quoteforlove::class.java))
}}
}
}
这是我尝试运行应用程序时遇到的所有麻烦:
10-06 12:20:27.419 24541-24541/? D/AndroidRuntime: Shutting down VM
10-06 12:20:27.429 24541-24541/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.pc.lovequoteandcalculator, PID: 24541
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.pc.lovequoteandcalculator/com.example.pc.lovequoteandcalculator.MainActivity}: android.view.InflateException: Binary XML file line #51: Error inflating class ImageView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2348)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2410)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1313)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5351)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:947)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742)
Caused by: android.view.InflateException: Binary XML file line #51: Error inflating class ImageView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.example.pc.lovequoteandcalculator.MainActivity.onCreate(MainActivity.kt:21)
at android.app.Activity.performCreate(Activity.java:6012)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2292)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2410)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1313)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5351)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:947)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f06005e
at android.content.res.Resources.getValue(Resources.java:1266)
at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:331)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:198)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:191)
at android.support.v7.content.res.AppCompatResources.getDrawable(AppCompatResources.java:102)
at android.support.v7.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:59)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:78)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:68)
at android.support.v7.app.AppCompatViewInflater.createImageView(AppCompatViewInflater.java:182)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
at android.support.v7.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1266)
at android.support.v7.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1316)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.example.pc.lovequoteandcalculator.MainActivity.onCreate(MainActivity.kt:21)
at android.app.Activity.performCreate(Activity.java:6012)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2292)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2410)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1313)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5351)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:947)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742)
10-06 12:20:27.429 784-1245/? W/ActivityManager: Force finishing activity 1 com.example.pc.lovequoteandcalculator/.MainActivity
10-06 12:20:27.429 784-1245/? D/WindowManager: Pausing WindowToken AppWindowToken{1f75ec47 token=Token{27320b86 ActivityRecord{ba03461 u0 com.example.pc.lovequoteandcalculator/.MainActivity t153}}}
10-06 12:20:27.429 784-1245/? D/BarController.StatusBar: setBarShowingLw state. show = true
10-06 12:20:27.429 784-1245/? D/ActivityManager: setFocusedActivityLocked: r=ActivityRecord{2bdf6f2 u0 com.teslacoilsw.launcher/.NovaLauncher t43} Caller=com.android.server.am.ActivityStack.adjustFocusedActivityLocked:2494 com.android.server.am.ActivityStack.finishActivityLocked:2722 com.android.server.am.ActivityStack.finishTopRunningActivityLocked:2597
10-06 12:20:27.429 784-1245/? D/InputDispatcher: mFocuseApplicationHandle change to:AppWindowToken{2377f3c0 token=Token{3d4c1143 ActivityRecord{2bdf6f2 u0 com.teslacoilsw.launcher/.NovaLauncher t43}}}
10-06 12:20:27.449 784-1245/? D/Bitmap: recycle bitmap... mNativeBitmap = -1572055824 , Bitmap = android.graphics.Bitmap@39626bc2
10-06 12:20:27.449 784-1245/? D/PowerManagerService: acquireWakeLockInternal: lock=441078506, flags=0x1, tag="ActivityManager-Launch", ws=null, uid=1000, pid=784
10-06 12:20:27.449 784-784/? D/BroadcastQueue: Add broadcastBroadcastRecord{5c92dd3 u0 android.intent.action.DROPBOX_ENTRY_ADDED} into (background/order), now header = BroadcastRecord{5c92dd3 u0 android.intent.action.DROPBOX_ENTRY_ADDED}, size = 1
10-06 12:20:27.459 784-860/? D/WindowManager: Input focus has changed to Window{36cf1a27 u0 Application Error: com.example.pc.lovequoteandcalculator}
10-06 12:20:27.469 784-860/? D/InputDispatcher: Focus entered window: Window{36cf1a27 u0 Application Error: com.example.pc.lovequoteandcalculator}
10-06 12:20:27.489 784-799/? D/BroadcastQueue: Finished with ordered broadcast BroadcastRecord{5c92dd3 u0 android.intent.action.DROPBOX_ENTRY_ADDED}, [background], remain = 0
10-06 12:20:27.509 784-18437/? I/OpenGLRenderer: Initialized EGL, version 1.4
10-06 12:20:27.519 784-1583/? D/BroadcastQueue: Add broadcastBroadcastRecord{31c228a5 u0 com.kingroot.common.ACTION_TOP_ACTIVITY_CHANGED} into (background/order), now header = BroadcastRecord{31c228a5 u0 com.kingroot.common.ACTION_TOP_ACTIVITY_CHANGED}, size = 1
10-06 12:20:27.519 784-2074/? D/BroadcastQueue: Add broadcastBroadcastRecord{2cabc47a u0 com.kingroot.common.ACTION_SWITCH_OUT_DESKTOP} into (background/order), now header = BroadcastRecord{31c228a5 u0 com.kingroot.common.ACTION_TOP_ACTIVITY_CHANGED}, size = 2
10-06 12:20:27.529 784-2170/? D/BroadcastQueue: Add broadcastBroadcastRecord{b5c042b u0 com.kingroot.common.ACTION_TOP_APP_CHANGED} into (background/order), now header = BroadcastRecord{31c228a5 u0 com.kingroot.common.ACTION_TOP_ACTIVITY_CHANGED}, size = 3
10-06 12:20:27.529 784-3298/? W/ActivityManager: getRunningAppProcesses: caller 10062 does not hold REAL_GET_TASKS; limiting output
10-06 12:20:27.549 784-1732/? D/BroadcastQueue: Finished with ordered broadcast BroadcastRecord{31c228a5 u0 com.kingroot.common.ACTION_TOP_ACTIVITY_CHANGED}, [background], remain = 2
10-06 12:20:27.559 784-800/? D/BroadcastQueue: Finished with ordered broadcast BroadcastRecord{2cabc47a u0 com.kingroot.common.ACTION_SWITCH_OUT_DESKTOP}, [background], remain = 1
10-06 12:20:27.569 784-888/? D/BroadcastQueue: Finished with ordered broadcast BroadcastRecord{b5c042b u0 com.kingroot.common.ACTION_TOP_APP_CHANGED}, [background], remain = 0
10-06 12:20:27.619 1159-1174/? I/art: Background sticky concurrent mark sweep GC freed 31401(2MB) AllocSpace objects, 81(1386KB) LOS objects, 40% free, 5MB/9MB, paused 17.486ms total 70.190ms
10-06 12:20:27.619 784-1864/? D/PowerManagerService: acquireWakeLockInternal: lock=515583217, flags=0x1, tag="CMWakeLock", ws=WorkSource{10031 com.google.android.gms}, uid=10031, pid=2262
10-06 12:20:27.629 784-1732/? D/PowerManagerService: releaseWakeLockInternal: lock=515583217 [CMWakeLock], flags=0x0
10-06 12:20:27.699 2262-2276/? I/art: Background sticky concurrent mark sweep GC freed 129801(5MB) AllocSpace objects, 9(471KB) LOS objects, 22% free, 23MB/30MB, paused 5.126ms total 166.259ms
10-06 12:20:27.849 1099-23989/? D/BatteryMeterView: TimerTask :run --level = 79
10-06 12:20:27.849 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:27.869 1099-23990/? D/BatteryMeterView: TimerTask :run --level = 79
10-06 12:20:27.869 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:27.879 1099-23991/? D/BatteryMeterView: TimerTask :run --level = 79
10-06 12:20:27.879 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:27.949 784-860/? W/ActivityManager: Activity pause timeout for ActivityRecord{ba03461 u0 com.example.pc.lovequoteandcalculator/.MainActivity t153 f}
10-06 12:20:27.949 784-860/? D/WindowManager: Resuming WindowToken AppWindowToken{1f75ec47 token=Token{27320b86 ActivityRecord{ba03461 u0 com.example.pc.lovequoteandcalculator/.MainActivity t153}}}
10-06 12:20:27.979 160-160/? D/gralloc.sc8830: fb_post fps = 36.387661
10-06 12:20:27.979 1472-1472/? V/Activity: calling onResume for activity: com.teslacoilsw.launcher
10-06 12:20:27.989 784-1157/? D/ActivityManager: write rtcc async failed
10-06 12:20:27.989 784-1157/? I/ActivityManager: async trigger rtcc
10-06 12:20:27.989 784-1157/? W/System.err: java.io.FileNotFoundException: /sys/class/rtcc/rtcc_trigger: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:456)
at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
at java.io.FileOutputStream.<init>(FileOutputStream.java:127)
at java.io.FileWriter.<init>(FileWriter.java:96)
at com.android.server.am.ActivityManagerService.writeAsyncToRtcc(ActivityManagerService.java:20218)
at com.android.server.am.ActivityManagerService.activityResumed(ActivityManagerService.java:6437)
at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:504)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2250)
10-06 12:20:27.999 784-1157/? W/System.err: at android.os.Binder.execTransact(Binder.java:469)
10-06 12:20:27.999 784-1157/? I/ActivityManager: Resumed activity; dropping state of: ActivityRecord{2bdf6f2 u0 com.teslacoilsw.launcher/.NovaLauncher t43}
10-06 12:20:27.999 784-1157/? W/System.err: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
at libcore.io.IoBridge.open(IoBridge.java:442)
... 8 more
10-06 12:20:28.049 784-2170/? D/PowerManagerService: releaseWakeLockInternal: lock=441078506 [ActivityManager-Launch], flags=0x0
10-06 12:20:28.059 784-798/? I/art: Background sticky concurrent mark sweep GC freed 19954(1096KB) AllocSpace objects, 4(64KB) LOS objects, 3% free, 34MB/35MB, paused 11.596ms total 68.786ms
10-06 12:20:28.089 784-879/? D/BarController.StatusBar: setBarShowingLw state. show = true
setBarShowingLw state. show = true
10-06 12:20:28.089 784-879/? D/InputDispatcher: Window went away: Window{3f49055e u0 Starting com.example.pc.lovequoteandcalculator}
10-06 12:20:28.099 784-879/? D/BarController.StatusBar: setBarShowingLw state. show = true
10-06 12:20:28.259 206-248/? D/phoneserver: Receive thread's TID [248] CHNMNG:readline pread= 0xb6f226e0,count=14
Receive thread's TID [248] CHMNG: receive data thread :mux=/dev/stty_w3:input:+CSQ: 5,99
Receive thread's TID [248] MUX :/dev/stty_w3 Waiting for resp
10-06 12:20:28.259 784-1842/? D/SignalStrengthUtilsSprd: processLteLevel: empty method
10-06 12:20:28.259 1099-1099/? D/SignalStrengthUtilsSprd: processLteLevel: empty method
10-06 12:20:28.339 784-879/? D/BarController.StatusBar: setBarShowingLw state. show = true
setBarShowingLw state. show = true
10-06 12:20:28.349 784-879/? D/BarController.StatusBar: setBarShowingLw state. show = true
10-06 12:20:28.540 784-879/? D/BarController.StatusBar: setBarShowingLw state. show = true
10-06 12:20:28.560 784-879/? D/BarController.StatusBar: setBarShowingLw state. show = true
10-06 12:20:28.630 1239-1239/? D/wpa_supplicant: wlan0: Control interface command 'SIGNAL_POLL'
10-06 12:20:28.640 1099-1099/? D/huangli: length--=1
label--=Telenor
10-06 12:20:28.640 1099-1099/? D/xdd: label = Telenor
10-06 12:20:28.850 1099-23989/? D/BatteryMeterView: TimerTask :run --level = 99
10-06 12:20:28.850 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:28.870 1099-23990/? D/BatteryMeterView: TimerTask :run --level = 99
10-06 12:20:28.870 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:28.880 1099-23991/? D/BatteryMeterView: TimerTask :run --level = 99
10-06 12:20:28.880 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:28.970 1099-1099/? W/ResourceType: No package identifier when getting value for resource number 0x00000000
10-06 12:20:28.970 1099-1099/? W/PackageManager: Failure retrieving resources for com.example.pc.lovequoteandcalculator: Resource ID #0x0
10-06 12:20:28.980 160-160/? D/gralloc.sc8830: fb_post fps = 50.888187
10-06 12:20:29.360 175-288/? D/WCND: is_cp2_alive_ok: open polling interface: /dev/spipe_wcn0, fd = 15
is_cp2_alive_ok: loop: /dev/spipe_wcn0 is OK
10-06 12:20:29.551 206-248/? D/phoneserver: Receive thread's TID [248] CHNMNG:readline pread= 0xb6f226e0,count=14
Receive thread's TID [248] CHMNG: receive data thread :mux=/dev/stty_w3:input:+CSQ: 6,99
Receive thread's TID [248] MUX :/dev/stty_w3 Waiting for resp
10-06 12:20:29.551 784-2170/? D/SignalStrengthUtilsSprd: processLteLevel: empty method
10-06 12:20:29.551 1099-1099/? D/SignalStrengthUtilsSprd: processLteLevel: empty method
10-06 12:20:29.641 784-1578/? W/ActivityManager: getRunningAppProcesses: caller 10186 does not hold REAL_GET_TASKS; limiting output
10-06 12:20:29.851 1099-23989/? D/BatteryMeterView: TimerTask :run --level = 59
10-06 12:20:29.851 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:29.871 1099-23990/? D/BatteryMeterView: TimerTask :run --level = 59
10-06 12:20:29.871 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:29.881 1099-23991/? D/BatteryMeterView: TimerTask :run --level = 59
10-06 12:20:29.881 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:30.812 206-248/? D/phoneserver: Receive thread's TID [248] CHNMNG:readline pread= 0xb6f226e0,count=14
Receive thread's TID [248] CHMNG: receive data thread :mux=/dev/stty_w3:input:+CSQ: 6,99
Receive thread's TID [248] MUX :/dev/stty_w3 Waiting for resp
10-06 12:20:30.822 784-2019/? D/SignalStrengthUtilsSprd: processLteLevel: empty method
10-06 12:20:30.822 1099-1099/? D/SignalStrengthUtilsSprd: processLteLevel: empty method
10-06 12:20:30.852 1099-23989/? D/BatteryMeterView: TimerTask :run --level = 79
10-06 12:20:30.852 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:30.872 1099-23990/? D/BatteryMeterView: TimerTask :run --level = 79
10-06 12:20:30.872 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:30.882 160-160/? D/gralloc.sc8830: fb_post fps = 1.054125
10-06 12:20:30.882 1099-23991/? D/BatteryMeterView: TimerTask :run --level = 79
10-06 12:20:30.882 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:31.573 784-2074/? D/BroadcastQueue: Add broadcastBroadcastRecord{5c78515 u0 com.tinno.widget.MemoryManager1x1.action.REALTIME_UPDATE} into (background/order), now header = BroadcastRecord{5c78515 u0 com.tinno.widget.MemoryManager1x1.action.REALTIME_UPDATE}, size = 1
10-06 12:20:31.573 6102-6102/com.tinno.memorywidget I/MemoryWidgetManager_1x1: [onReceive]action:com.tinno.widget.MemoryManager1x1.action.REALTIME_UPDATE
[onReceive]realTimeUpateWidget
10-06 12:20:31.583 6102-6102/com.tinno.memorywidget I/MemoryWidgetManager_1x1: [onReceive] END
10-06 12:20:31.583 784-2170/? D/BroadcastQueue: Finished with ordered broadcast BroadcastRecord{5c78515 u0 com.tinno.widget.MemoryManager1x1.action.REALTIME_UPDATE}, [background], remain = 0
10-06 12:20:31.643 1239-1239/? D/wpa_supplicant: wlan0: Control interface command 'SIGNAL_POLL'
10-06 12:20:31.653 1099-1099/? D/huangli: length--=1
label--=Telenor
10-06 12:20:31.653 1099-1099/? D/xdd: label = Telenor
10-06 12:20:31.853 1099-23989/? D/BatteryMeterView: TimerTask :run --level = 99
10-06 12:20:31.853 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:31.873 1099-23990/? D/BatteryMeterView: TimerTask :run --level = 99
10-06 12:20:31.873 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:31.883 160-160/? D/gralloc.sc8830: fb_post fps = 1.999512
10-06 12:20:31.883 1099-23991/? D/BatteryMeterView: TimerTask :run --level = 99
10-06 12:20:31.883 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:32.103 206-248/? D/phoneserver: Receive thread's TID [248] CHNMNG:readline pread= 0xb6f226e0,count=14
Receive thread's TID [248] CHMNG: receive data thread :mux=/dev/stty_w3:input:+CSQ: 6,99
Receive thread's TID [248] MUX :/dev/stty_w3 Waiting for resp
10-06 12:20:32.103 784-3298/? D/SignalStrengthUtilsSprd: processLteLevel: empty method
10-06 12:20:32.103 1099-1099/? D/SignalStrengthUtilsSprd: processLteLevel: empty method
10-06 12:20:32.854 1099-23989/? D/BatteryMeterView: TimerTask :run --level = 59
10-06 12:20:32.854 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:32.874 1099-23990/? D/BatteryMeterView: TimerTask :run --level = 59
10-06 12:20:32.884 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:32.884 1099-23991/? D/BatteryMeterView: TimerTask :run --level = 59
10-06 12:20:32.884 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:33.384 206-248/? D/phoneserver: Receive thread's TID [248] CHNMNG:readline pread= 0xb6f226e0,count=14
Receive thread's TID [248] CHMNG: receive data thread :mux=/dev/stty_w3:input:+CSQ: 5,99
Receive thread's TID [248] MUX :/dev/stty_w3 Waiting for resp
10-06 12:20:33.384 784-1842/? D/SignalStrengthUtilsSprd: processLteLevel: empty method
10-06 12:20:33.384 1099-1099/? D/SignalStrengthUtilsSprd: processLteLevel: empty method
10-06 12:20:33.865 1099-23989/? D/BatteryMeterView: TimerTask :run --level = 79
10-06 12:20:33.865 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:33.875 1099-23990/? D/BatteryMeterView: TimerTask :run --level = 79
10-06 12:20:33.885 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:33.885 160-160/? D/gralloc.sc8830: fb_post fps = 1.000458
10-06 12:20:33.885 1099-23991/? D/BatteryMeterView: TimerTask :run --level = 79
10-06 12:20:33.885 1099-1099/? D/BatteryMeterView: handleMessage
10-06 12:20:34.365 175-288/? D/WCND: is_cp2_alive_ok: open polling interface: /dev/spipe_wcn0, fd = 15
is_cp2_alive_ok: loop: /dev/spipe_wcn0 is OK
10-06 12:20:34.656 206-248/? D/phoneserver: Receive thread's TID [248] CHNMNG:readline pread= 0xb6f226e0,count=14
Receive thread's TID [248] CHMNG: receive data thread :mux=/dev/stty_w3:input:+CSQ: 6,99
Receive thread's TID [248] MUX :/dev/stty_w3 Waiting for resp
10-06 12:20:34.666 1239-1239/? D/wpa_supplicant: wlan0: Control interface command 'SIGNAL_POLL'
10-06 12:20:34.666 784-1154/? D/SignalStrengthUtilsSprd: processLteLevel: empty method
10-06 12:20:34.666 1099-1099/? D/SignalStrengthUtilsSprd: processLteLevel: empty method
10-06 12:20:34.836 784-1068/? E/WifiStateMachine: WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=0.00 rxSuccessRate=0.00 targetRoamBSSID=18:d6:c7:dc:4c:b0 RSSI=-55
WifiStateMachine starting scan for "TP-LINK_4CB0"WPA_PSK with 2417
10-06 12:20:34.836 1239-1239/? D/wpa_supplicant: wlan0: Control interface command 'SCAN TYPE=ONLY freq=2417'
布局主要活动:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gradint"
tools:context=".MainActivity">
<Button
android:id="@+id/btnlovecal"
android:layout_width="match_parent"
android:layout_height="116dp"
android:layout_marginBottom="292dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:text="@string/love_calculator"
android:textAlignment="center"
android:textColor="#cd49e1"
android:textSize="25sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/btnquote"
android:layout_width="match_parent"
android:layout_height="122dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="@string/get_qoute_with_name"
android:textAlignment="center"
android:textColor="#f659f9"
android:textSize="25sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/btnlovecal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.14" />
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="254dp"
android:layout_marginBottom="16dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.504"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/asdff"
android:contentDescription="@string/todo" />
</android.support.constraint.ConstraintLayout>
`
答案 0 :(得分:0)
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/android" />
使用上面的代码代替srcCompat并尝试与LinearLayout和RelativeLayout一起使用。谢谢