AS 运行时出现Error Default Activity not found

完全按照《第一行代码 第二版》中的内容进行操作,可进行到第36页时就无法运行。

明明已经写好了一个有界面的程序,可就是不能运行。如果在app选项卡里将Launch Options 的 Default Activity改为Nothing的话,的确不报错了,也能运行了,但编写的界面也没了。

6个回答

在我重启软件无数遍,一通乱点和瞎按之后……就好了……(基本就是restart rebulid来回点)感谢楼上几位老板的解答,我的的确确是没有少写任何东西……非常感谢!(AS简直玄学)图片说明

<activity
        android:name="com.your.package.name.YourActivity"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
</activity> 

intent-filter标签里的内容设置当前activity是应用启动时的默认activity,是不是忘了写这个?

你看下是不是Mainfest文件中没有注册你要启动的activity。

每手动新建一个activity都需要在Mainfest文件里注册该activity, 不然的话肯定会报错

啊啊啊啊,我快要疯了,我的activity在Mainfest文件中注册了,而且也配置成了主活动,还是有这个问题,网上各种方法都试过楼主的经历我也有但还是解决不了,是AS的问题吗?

备份.重建同名工程.然后覆盖.问题解决

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
android libGDX 错误信息

开发的游戏在笔记本中运行,但是到了android上后log出现如下信息: 04-01 21:50:10.314: D/ActivityThread(21047): setTargetHeapConcurrentStart:2097152 04-01 21:50:10.334: D/dalvikvm(21047): Trying to load lib /data/data/com.vulcanic.flickit/lib/libgdx.so 0x41e53a48 04-01 21:50:10.334: D/dalvikvm(21047): Added shared lib /data/data/com.vulcanic.flickit/lib/libgdx.so 0x41e53a48 04-01 21:50:10.334: D/dalvikvm(21047): No JNI_OnLoad found in /data/data/com.vulcanic.flickit/lib/libgdx.so 0x41e53a48, skipping init 04-01 21:50:10.344: D/libEGL(21047): loaded /system/lib/egl/libEGL_adreno200.so 04-01 21:50:10.344: D/libEGL(21047): loaded /system/lib/egl/libGLESv1_CM_adreno200.so 04-01 21:50:10.354: D/libEGL(21047): loaded /system/lib/egl/libGLESv2_adreno200.so 04-01 21:50:10.364: I/Adreno200-EGL(21047): <qeglDrvAPI_eglInitialize:269>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_JB_REL_RB4.04.01.02.16.049_msm8960_JB_REL_RB4.2_Merge_release_AU (Merge) 04-01 21:50:10.364: I/Adreno200-EGL(21047): Build Date: 12/12/12 Wed 04-01 21:50:10.364: I/Adreno200-EGL(21047): Local Branch: 04-01 21:50:10.364: I/Adreno200-EGL(21047): Remote Branch: m/jb_rel_rb4.2 04-01 21:50:10.364: I/Adreno200-EGL(21047): Local Patches: NONE 04-01 21:50:10.364: I/Adreno200-EGL(21047): Reconstruct Branch: AU_LINUX_ANDROID_JB_REL_RB4.04.01.02.16.049 + NOTHING android工程的目录中有`armeabi`和`armeabi-v7a`。 使用的版本是IntelliJ IDEA 12.0.4。

小米智能家庭插件开发,找不到默认activity

Could not identify launch activity: Default Activity not found Error while Launching activity ![图片说明](https://img-ask.csdn.net/upload/201605/30/1464587270_662375.png) 小米智能家庭插件开发中出现的问题,找不到activity,求大神解答

ReactNative 使用用第三方组件react-native-svg时Android下出现错误

ReactNative 使用用第三方组件react-native-svg时Android下出现错误,IOS 正常,希望哪位大神能尽快帮解决,谢谢!!错误如下: ``` Unable to launch redbox because react activity is not available, here is the error that redbox would've displayed: Invariant Violation: Native component for "RNSVGPath" does not exist ... ```

关于真机运行和虚拟机运行的小问题

在一个fragment里面写了一个SwipeRefreshLayout内含listview。真机运行的时候 listview的内容不会显示,但虚拟机会显示,listview的内容原是自己电脑作为服务器的 jsp传递的,这个下拉刷新两者都能用,请问这是什么原因??怎么解决 贴上代码 package com.example.my_coffeehouse.fragment; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.example.my_coffeehouse.activity.R; import com.example.my_coffeehouse.util.Constant; import com.example.my_coffeehouse.util.HttpUploadUtil; import android.annotation.SuppressLint; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.v4.app.Fragment; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ListView; import android.widget.SimpleAdapter; /** * 这是订单页面 * * @author Administrator * */ public class Main_OrderFragment extends Fragment { private static final int REFRESH_COMPLETE = 0X110; private SwipeRefreshLayout mSwipeLayout; private SimpleAdapter sa; private View view; private ListView lv; private String aurl = Constant.aURL + "/order/AshowOrder.jsp"; private Map<String, String> params; // 与服务器交互的标识 private Handler handler; private String[] listArray; @SuppressLint({ "HandlerLeak", "InlinedApi" }) public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.inflate(R.layout.main_item_order, container, false);// 这个就相当于你加的布局 params = new HashMap<String, String>(); params.put("parame1", "wok"); new Thread() { public void run() { // 获取服务器端传输到客户端的字符串 String msgStr = HttpUploadUtil.postWithoutFile(aurl, params); Bundle b = new Bundle(); b.putString("msg", msgStr); Message msg = new Message(); msg.setData(b); msg.what = Constant.WORKER; handler.sendMessage(msg); }// run }.start(); mSwipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.order_swipe); mSwipeLayout.setColorScheme(android.R.color.holo_green_dark, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light); mSwipeLayout.setOnRefreshListener(new OnRefreshListener() { public void onRefresh() { handler.sendEmptyMessageDelayed(REFRESH_COMPLETE, 2000); } }); // 将子线程执行的结果,交互主线程 handler = new Handler() { public void handleMessage(Message msg) { switch (msg.what) { case Constant.WORKER: Bundle b = msg.getData(); String m = b.getString("msg"); // 将子线程执行结果,m,交互给主线程UI层,即listView显示。 initData(m); break; case REFRESH_COMPLETE: // mDatas.addAll(Arrays.asList("Lucene", // "Canvas","Bitmap")); // sa.notifyDataSetChanged(); mSwipeLayout.setRefreshing(false); break; default: break; } } };// handler; return view; } /** * 将jsp返回的值进行解析 * * @param msg */ private void initData(String msg) { listArray = msg.split("\\|"); final int count = listArray.length / 5;// 多少条记录 List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); Map<String, Object> map = new HashMap<String, Object>(); for (int i = 0; i < count; i++) { map = new HashMap<String, Object>(); map.put("shop", listArray[5 * i + 1]); map.put("content", listArray[5 * i + 4]); map.put("money", listArray[5 * i + 2]); map.put("time", listArray[5 * i + 3]); map.put("transition", "已完成"); list.add(map); } lv = (ListView) view.findViewById(R.id.find_listview); sa = new SimpleAdapter(this.getActivity(), list, R.layout.find_listview_item, new String[] { "shop", "content", "money", "time", "transition" }, new int[] { R.id.find_lv_item_shop, R.id.find_lv_item_content, R.id.find_lv_item_money, R.id.find_lv_item_time, R.id.find_lv_item_transition }); lv.setAdapter(sa); } }

android配置文件时出错,但是APP正常运行

![图片说明](https://img-ask.csdn.net/upload/201507/07/1436254196_960387.png) 这个是什么情况?求指点 com.Com_send_serv has no default constructor validates resource references inside Android xml files com.Com_send_serv is not assignable to android.app.service validates resource references inside Android xml files

Appium+Python爬虫无法启动APP

非计算机专业,初学python和appium,需要抓取小红书APP的数据,连接夜神模拟器,但是无法启动APP,一直报错找不到原因,下面放上appium工作日志希望各路大神可以帮帮忙。谢谢大家! ``` [W3C] Calling AppiumDriver.createSession() with args: [{"platformName":"Android","deviceName":"127.0.0.1:62025","appPackage":"com.xingin.xhs","platformVersion":"5.1.1","appActivity":".activity.SplashActivity","noReset":true,"unicodeKeyboard":true},null,{"firstMatch":[{"platformName":"Android","appium:deviceName":"127.0.0.1:62025","appium:appPackage":"com.xingin.xhs","appium:platformVersion":"5.1.1","appium:appActivity":".activity.SplashActivity","appium:noReset":true,"appium:unicodeKeyboard":true}]}] [BaseDriver] Event 'newSessionRequested' logged at 1553679403156 (17:36:43 GMT+0800 (中国标准时间)) [Appium] DeprecationWarning: 'automationName' capability was not provided. Future versions of Appium will require 'automationName' capability to be set for Android sessions. [Appium] Setting automation to 'UiAutomator1'. [Appium] Creating new AndroidDriver (v4.8.0) session [Appium] Capabilities: [Appium] platformName: Android [Appium] deviceName: 127.0.0.1:62025 [Appium] appPackage: com.xingin.xhs [Appium] platformVersion: 5.1.1 [Appium] appActivity: .activity.SplashActivity [Appium] noReset: true [Appium] unicodeKeyboard: true [BaseDriver] W3C capabilities {"alwaysMatch":{"platformNa... and MJSONWP desired capabilities {"platformName":"Android","... were provided [BaseDriver] Creating session with W3C capabilities: {"alwaysMatch":{"platformNa... [BaseDriver] Session created with session id: 4aa3fc42-b895-499c-b714-aaaf47854f3a [AndroidDriver] Java version is: 1.8.0_201 [AndroidDriver] Retrieving device list [ADB] Trying to find a connected android device [ADB] Getting connected devices... [ADB] 1 device(s) connected [AndroidDriver] Looking for a device with Android '5.1.1' [ADB] Setting device id to 127.0.0.1:62001 [ADB] Getting device platform version [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell getprop ro.build.version.release' [ADB] Current device property 'ro.build.version.release': 5.1.1 [AndroidDriver] Using device: 127.0.0.1:62001 [ADB] Setting device id to 127.0.0.1:62001 [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell getprop ro.build.version.sdk' [ADB] Current device property 'ro.build.version.sdk': 22 [ADB] Device API level: 22 [AndroidDriver] App file was not listed, instead we're going to run com.xingin.xhs directly on the device [AndroidDriver] Checking whether package is present on the device [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell pm list packages com.xingin.xhs' [AndroidDriver] Starting Android session [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 wait-for-device' [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell echo ping' [AndroidDriver] Pushing settings apk to device... [ADB] Getting install status for io.appium.settings [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell dumpsys package io.appium.settings' [ADB] 'io.appium.settings' is not installed [ADB] App 'C:\Users\zlp\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk' is not installed [ADB] Installing 'C:\Users\zlp\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk' [ADB] Skipping permissions grant option, since the current API level 22 does not support applications permissions customization [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 install C\:\\Users\\zlp\\AppData\\Local\\Programs\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\io.appium.settings\\apks\\settings_apk-debug.apk' [ADB] Install command stdout: pkg: /data/local/tmp/settings_apk-debug.apk [ADB] Success [ADB] Getting IDs of all 'io.appium.settings' processes [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell 'pgrep --help; echo $?'' [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell 'pidof --help > /dev/null; echo $?'' [ADB] Using ps-based PID detection [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell ps' [AndroidDriver] Granting android.permission.SET_ANIMATION_SCALE, CHANGE_CONFIGURATION, ACCESS_FINE_LOCATION by pm grant [ADB] Granting permissions ["android.permission.SET_ANIMATION_SCALE","android.permission.CHANGE_CONFIGURATION","android.permission.ACCESS_FINE_LOCATION"] to 'io.appium.settings' [ADB] Got the following command chunks to execute: [["pm","grant","io.appium.settings","android.permission.SET_ANIMATION_SCALE",";","pm","grant","io.appium.settings","android.permission.CHANGE_CONFIGURATION",";","pm","grant","io.appium.settings","android.permission.ACCESS_FINE_LOCATION",";"]] [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell pm grant io.appium.settings android.permission.SET_ANIMATION_SCALE \; pm grant io.appium.settings android.permission.CHANGE_CONFIGURATION \; pm grant io.appium.settings android.permission.ACCESS_FINE_LOCATION \;' [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell am start -W -n io.appium.settings/.Settings -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000' [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell settings put secure mock_location 1' [Logcat] Starting logcat capture [AndroidDriver] Enabling Unicode keyboard support [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell settings get secure default_input_method' [AndroidDriver] Unsetting previous IME com.android.inputservice/.InputService [AndroidDriver] Setting IME to 'io.appium.settings/.UnicodeIME' [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell ime enable io.appium.settings/.UnicodeIME' [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell ime set io.appium.settings/.UnicodeIME' [ADB] Getting device platform version [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell getprop ro.build.version.release' [ADB] Current device property 'ro.build.version.release': 5.1.1 [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell wm size' [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell getprop ro.product.model' [ADB] Current device property 'ro.product.model': MI 6 [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell getprop ro.product.manufacturer' [ADB] Current device property 'ro.product.manufacturer': Xiaomi [AndroidDriver] No app sent in, not parsing package/activity [AndroidDriver] No app capability. Assuming it is already on the device [AndroidBootstrap] Watching for bootstrap disconnect [ADB] Forwarding system: 4724 to device: 4724 [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 forward tcp\:4724 tcp\:4724' [UiAutomator] Starting UiAutomator [UiAutomator] Moving to state 'starting' [UiAutomator] Parsing uiautomator jar [UiAutomator] Found jar name: 'AppiumBootstrap.jar' [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 push C\:\\Users\\zlp\\AppData\\Local\\Programs\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-android-driver\\bootstrap\\bin\\AppiumBootstrap.jar /data/local/tmp/' [ADB] Attempting to kill all uiautomator processes [ADB] Getting IDs of all 'uiautomator' processes [ADB] Using ps-based PID detection [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell ps' [ADB] No 'uiautomator' process has been found [UiAutomator] Starting UIAutomator [ADB] Creating ADB subprocess with args: ["-P",5037,"-s","127.0.0.1:62001","shell","uiautomator","runtest","AppiumBootstrap.jar","-c","io.appium.android.bootstrap.Bootstrap","-e","pkg","com.xingin.xhs","-e","disableAndroidWatchers",false,"-e","acceptSslCerts",false] [UiAutomator] Moving to state 'online' [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Loading json... [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Registered crash watchers. [AndroidBootstrap] Android bootstrap socket is now connected [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell dumpsys window' [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Client connected [AndroidDriver] Screen already unlocked, doing nothing [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell am start -W -n com.xingin.xhs/.activity.SplashActivity -S' [AndroidDriver] Shutting down Android driver [ADB] Running 'D:\android-sdk\sdk\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:62001 shell am force-stop com.xingin.xhs' [BaseDriver] Event 'newSessionStarted' logged at 1553679571306 (17:39:31 GMT+0800 (中国标准时间)) [W3C] Encountered internal error running command: Error: Cannot start the 'com.xingin.xhs' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command 'D\:\\android-sdk\\sdk\\adt-bundle-windows-x86_64-20140702\\sdk\\platform-tools\\adb.exe -P 5037 -s 127.0.0.1\:62001 shell am start -W -n com.xingin.xhs/.activity.SplashActivity -S' timed out after 20000ms'. Try to increase the 20000ms adb execution timeout represented by 'adbExecTimeout' capability [W3C] at ADB.apkUtilsMethods.startApp (C:\Users\zlp\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:144:11) [HTTP] <-- POST /wd/hub/session 500 168162 ms - 1794 [HTTP] ```

appium-desktop启动模拟器adb命令超时失败

1appium-desktop启动模拟器adb命令超时失败 2.使用appium-server启动没有问题 报错如下: ``` [Appium] Welcome to Appium v1.15.0 [Appium] Non-default server args: [Appium] allowInsecure: { [Appium] } [Appium] denyInsecure: { [Appium] } [Appium] Appium REST http interface listener started on 0.0.0.0:4723 [HTTP] --> POST /wd/hub/session [HTTP] {"capabilities":{"firstMatch":[{}],"alwaysMatch":{"platformName":"Android"}},"desiredCapabilities":{"platformName":"Android","platformVersion":"5.1.1","deviceName":"Android Emulator","appPackage":"com.android.calculator2","appActivity":".Calculator"}} [W3C] Calling AppiumDriver.createSession() with args: [{"platformName":"Android","platformVersion":"5.1.1","deviceName":"Android Emulator","appPackage":"com.android.calculator2","appActivity":".Calculator"},null,{"firstMatch":[{}],"alwaysMatch":{"platformName":"Android"}}] [BaseDriver] Event 'newSessionRequested' logged at 1571708607532 (09:43:27 GMT+0800 (中国标准时间)) [Appium] Could not parse W3C capabilities: 'deviceName' can't be blank [Appium] Trying to fix W3C capabilities by merging them with JSONWP caps [BaseDriver] The capabilities ["platformVersion","deviceName","appPackage","appActivity"] are not standard capabilities and should have an extension prefix [Appium] [Appium] ====================================================================== [Appium] DEPRECATION WARNING: [Appium] [Appium] The 'automationName' capability was not provided in the desired [Appium] capabilities for this Android session [Appium] [Appium] Setting 'automationName=UiAutomator2' by default and using the [Appium] UiAutomator2 Driver [Appium] [Appium] The next major version of Appium (2.x) will **require** the [Appium] 'automationName' capability to be set for all sessions on all [Appium] platforms [Appium] [Appium] In previous versions (Appium <= 1.13.x), the default was [Appium] 'automationName=UiAutomator1' [Appium] [Appium] If you wish to use that automation instead of UiAutomator2, please [Appium] add 'automationName=UiAutomator1' to your desired capabilities [Appium] [Appium] For more information about drivers, please visit [Appium] http://appium.io/docs/en/about-appium/intro/ and explore the [Appium] 'Drivers' menu [Appium] [Appium] ====================================================================== [Appium] [Appium] Appium v1.15.0 creating new AndroidUiautomator2Driver (v1.37.1) session [BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided [BaseDriver] Creating session with W3C capabilities: { [BaseDriver] "alwaysMatch": { [BaseDriver] "platformName": "Android", [BaseDriver] "appium:platformVersion": "5.1.1", [BaseDriver] "appium:deviceName": "Android Emulator", [BaseDriver] "appium:appPackage": "com.android.calculator2", [BaseDriver] "appium:appActivity": ".Calculator" [BaseDriver] }, [BaseDriver] "firstMatch": [ [BaseDriver] {} [BaseDriver] ] [BaseDriver] } [BaseDriver] Session created with session id: 838e3971-499e-42b3-aacd-1ef1a14ff4be [UiAutomator2] Starting 'com.android.calculator2' directly on the device [ADB] Found 1 'build-tools' folders under 'E:\androidsdk\android-sdk-windows' (newest first): [ADB] E:/androidsdk/android-sdk-windows/build-tools/29.0.2 [ADB] Using 'adb.exe' from 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe' [AndroidDriver] Retrieving device list [ADB] Trying to find a connected android device [ADB] Getting connected devices... [ADB] Connected devices: [{"udid":"emulator-5554","state":"device"}] [AndroidDriver] Looking for a device with Android '5.1.1' [ADB] Setting device id to emulator-5554 [ADB] Getting device platform version [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell getprop ro.build.version.release' [ADB] Current device property 'ro.build.version.release': 5.1.1 [AndroidDriver] Using device: emulator-5554 [ADB] Using 'adb.exe' from 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe' [ADB] Setting device id to emulator-5554 [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk' [ADB] Current device property 'ro.build.version.sdk': 22 [ADB] Device API level: 22 [AndroidDriver] No app sent in, not parsing package/activity [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 wait-for-device' [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell echo ping' [AndroidDriver] Pushing settings apk to device... [ADB] Getting install status for io.appium.settings [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys package io.appium.settings' [ADB] 'io.appium.settings' is installed [ADB] Getting package info for 'io.appium.settings' [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys package io.appium.settings' [ADB] Cannot extract apk info using apkanalyzer. Falling back to aapt. Original error: Could not find 'apkanalyzer.bat' in ["E:\\androidsdk\\android-sdk-windows\\platform-tools\\apkanalyzer.bat","E:\\androidsdk\\android-sdk-windows\\emulator\\apkanalyzer.bat","E:\\androidsdk\\android-sdk-windows\\tools\\apkanalyzer.bat","E:\\androidsdk\\android-sdk-windows\\tools\\bin\\apkanalyzer.bat","E:\\androidsdk\\android-sdk-windows\\build-tools\\29.0.2\\apkanalyzer.bat"]. Do you have Android Build Tools installed at 'E:\androidsdk\android-sdk-windows'? [ADB] Using 'aapt.exe' from 'E:\androidsdk\android-sdk-windows\build-tools\29.0.2\aapt.exe' [ADB] The version name of the installed 'io.appium.settings' is greater or equal to the application version name ('2.14.2' >= '2.14.2') [ADB] There is no need to install/upgrade 'C:\Users\Administrator\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk' [ADB] Getting IDs of all 'io.appium.settings' processes [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell 'pgrep --help; echo $?'' [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell 'pidof --help > /dev/null; echo $?'' [ADB] Using ps-based PID detection [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell ps' [AndroidDriver] io.appium.settings is already running. There is no need to reset its permissions. [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell settings put secure mock_location 1' [Logcat] Starting logcat capture [ADB] Getting install status for io.appium.uiautomator2.server [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server' [ADB] 'io.appium.uiautomator2.server' is installed [ADB] Getting package info for 'io.appium.uiautomator2.server' [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server' [ADB] Cannot extract apk info using apkanalyzer. Falling back to aapt. Original error: Could not find 'apkanalyzer.bat' in ["E:\\androidsdk\\android-sdk-windows\\platform-tools\\apkanalyzer.bat","E:\\androidsdk\\android-sdk-windows\\emulator\\apkanalyzer.bat","E:\\androidsdk\\android-sdk-windows\\tools\\apkanalyzer.bat","E:\\androidsdk\\android-sdk-windows\\tools\\bin\\apkanalyzer.bat","E:\\androidsdk\\android-sdk-windows\\build-tools\\29.0.2\\apkanalyzer.bat"]. Do you have Android Build Tools installed at 'E:\androidsdk\android-sdk-windows'? [ADB] The version name of the installed 'io.appium.uiautomator2.server' is greater or equal to the application version name ('4.3.0' >= '4.3.0') [UiAutomator2] io.appium.uiautomator2.server installation state: sameVersionInstalled [ADB] Checking app cert for C:\Users\Administrator\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.3.0.apk [ADB] Using 'apksigner.bat' from 'E:\androidsdk\android-sdk-windows\build-tools\29.0.2\apksigner.bat' [ADB] Starting 'E:\androidsdk\android-sdk-windows\build-tools\29.0.2\apksigner.bat' with args '["verify","--print-certs","C:\\Users\\Administrator\\AppData\\Local\\Programs\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-uiautomator2-server\\apks\\appium-uiautomator2-server-v4.3.0.apk"]' [ADB] apksigner stdout: Signer #1 certificate DN: EMAILADDRESS=android@android.com, CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US [ADB] Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc [ADB] Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81 [ADB] Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87 [ADB] [ADB] 'C:\Users\Administrator\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.3.0.apk' is already signed. [ADB] Getting install status for io.appium.uiautomator2.server.test [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server.test' [ADB] 'io.appium.uiautomator2.server.test' is not installed [ADB] Checking app cert for C:\Users\Administrator\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk [ADB] Starting 'E:\androidsdk\android-sdk-windows\build-tools\29.0.2\apksigner.bat' with args '["verify","--print-certs","C:\\Users\\Administrator\\AppData\\Local\\Programs\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-uiautomator2-server\\apks\\appium-uiautomator2-server-debug-androidTest.apk"]' [ADB] apksigner stdout: Signer #1 certificate DN: EMAILADDRESS=android@android.com, CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US [ADB] Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc [ADB] Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81 [ADB] Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87 [ADB] [ADB] 'C:\Users\Administrator\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk' is already signed. [UiAutomator2] Server packages are going to be (re)installed [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell 'ls -t -1 /data/local/tmp/appium_cache 2>&1 || echo _ERROR_'' [ADB] The current Android API does not support extended ls options. Defaulting to no-options call [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell 'ls /data/local/tmp/appium_cache 2>&1 || echo _ERROR_'' [ADB] The count of applications in the cache: 2 [ADB] The application at 'C:\Users\Administrator\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.3.0.apk' is already cached to '/data/local/tmp/appium_cache/0cc1725a60a05dbb5d0d09256f2fc6ece7e3b10f.apk' [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell pm install -r /data/local/tmp/appium_cache/0cc1725a60a05dbb5d0d09256f2fc6ece7e3b10f.apk' [UiAutomator2] Deleting UiAutomator2 session [UiAutomator2] Deleting UiAutomator2 server session [WD Proxy] Matched '/' to command name 'deleteSession' [UiAutomator2] Did not get confirmation UiAutomator2 deleteSession worked; Error was: UnknownError: An unknown server-side error occurred while processing the command. Original error: Trying to proxy a session command without session id [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell am force-stop com.android.calculator2' [Logcat] Stopping logcat capture [ADB] Removing forwarded port socket connection: 8200 [ADB] Running 'E:\androidsdk\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 forward --remove tcp\:8200' [UiAutomator2] Unable to remove port forward 'Error executing adbExec. Original error: 'Command 'E:\\androidsdk\\android-sdk-windows\\platform-tools\\adb.exe -P 5037 -s emulator-5554 forward --remove tcp\:8200' exited with code 1'; Stderr: 'adb.exe: error: listener 'tcp:8200' not found'; Code: '1'' [BaseDriver] Event 'newSessionStarted' logged at 1571708636226 (09:43:56 GMT+0800 (中国标准时间)) [W3C] Encountered internal error running command: Error executing adbExec. Original error: 'Command 'E:\\androidsdk\\android-sdk-windows\\platform-tools\\adb.exe -P 5037 -s emulator-5554 shell pm install -r /data/local/tmp/appium_cache/0cc1725a60a05dbb5d0d09256f2fc6ece7e3b10f.apk' timed out after 20000ms'. Try to increase the 20000ms adb execution timeout represented by 'uiautomator2ServerInstallTimeout' capability [W3C] Error: Command 'E:\\androidsdk\\android-sdk-windows\\platform-tools\\adb.exe -P 5037 -s emulator-5554 shell pm install -r /data/local/tmp/appium_cache/0cc1725a60a05dbb5d0d09256f2fc6ece7e3b10f.apk' timed out after 20000ms [W3C] at Timeout.setTimeout (C:\Users\Administrator\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\teen_process\lib\exec.js:125:19) [W3C] at ontimeout (timers.js:427:11) [W3C] at tryOnTimeout (timers.js:289:5) [W3C] at listOnTimeout (timers.js:252:5) [W3C] at Timer.processTimers (timers.js:212:10) [HTTP] <-- POST /wd/hub/session 500 28715 ms - 1450 [HTTP] ```

错误:org.json.JSONException:java.lang.String类型的值<br无法转换为JSONObject

<div class="post-text" itemprop="text"> <p>I know I have seen all similar questions on SO. I tried to solve this error but I failed. I tried almost everything but does not get solution.</p> <p>My code is as follows:-</p> <pre><code>public class Tab2 extends Fragment { private static String TAG = Tab2.class.getSimpleName(); private EditText editText1,editText2,editText3; private Button button; private String name,email,password; private TextInputLayout inputLayoutName, inputLayoutEmail, inputLayoutPassword; private ProgressDialog pDialog; private SessionManager session; private database db; static InputStream is = null; static JSONObject jObj = null; static String json = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.tab2,container,false); pDialog = new ProgressDialog(getActivity()); pDialog.setCancelable(false); // Session manager session = new SessionManager(getActivity()); // SQLite database handler db = new database(getActivity()); // Check if user is already logged in or not if (session.isLoggedIn()) { // User is already logged in. Take him to main activity Intent intent = new Intent(getActivity(),MainActivity.class); startActivity(intent); } editText1 = (EditText)view.findViewById(R.id.name); editText2 = (EditText)view.findViewById(R.id.email); editText3 = (EditText)view.findViewById(R.id.password); inputLayoutEmail = (TextInputLayout)view. findViewById(R.id.view1); inputLayoutPassword = (TextInputLayout)view. findViewById(R.id.view2); inputLayoutName = (TextInputLayout)view. findViewById(R.id.view3); button = (Button)view.findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view1) { name = editText1.getText().toString().trim(); email = editText2.getText().toString().trim(); password = editText3.getText().toString().trim(); if (!validateName() || !validateEmail() || !validatePassword() ) { Log.d(TAG, "Successfull"); return; } try { new Thread(new Runnable() { @Override public void run() { registerUser(name, email, password); } }).start(); }catch (NullPointerException e){ e.printStackTrace(); } Toast.makeText(getActivity(), "Account Created Successfully!", Toast.LENGTH_SHORT).show(); Intent i = new Intent(getActivity(), MainActivity.class); startActivity(i); } }); return view; } public boolean validateName(){ if(name.isEmpty() ) { inputLayoutName.setError(getString(R.string.error_name1)); return false; } else if(name.length()&lt;3){ inputLayoutName.setError(getString(R.string.error_name2)); return false; } else inputLayoutName.setErrorEnabled(false); return true; } public boolean validateEmail(){ if(email.isEmpty() || !android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()){ inputLayoutEmail.setError(getString(R.string.error_email)); return false; } else inputLayoutEmail.setErrorEnabled(false); return true; } public boolean validatePassword(){ if(password.isEmpty() ){ inputLayoutPassword.setError(getString(R.string.error_password1)); return false; } else if(password.length()&lt;4){ inputLayoutPassword.setError(getString(R.string.error_password2)); return false; } else inputLayoutPassword.setErrorEnabled(false); return true; } public void registerUser(final String name, final String email, final String password){ String req = "req_request"; pDialog.setMessage("Registering ..."); showDialog(); RequestQueue requestQueue = Volley.newRequestQueue(getActivity()); StringRequest strReq = new StringRequest(Request.Method.POST, appConfig.url_sign, new Response.Listener&lt;String&gt;(){ @Override public void onResponse(String response) { try { JSONObject jObj = new JSONObject(response); boolean error = jObj.getBoolean("error"); Log.d(TAG,name + " " + email + " " + password ); if (!error) { String uid = jObj.getString("uid"); JSONObject user = jObj.getJSONObject("user"); String name = user.getString("name"); String email= user.getString("email"); String created_at = user.getString("created_at"); db.addUser(name, email, uid, created_at); Toast.makeText(getActivity(), "User successfully registered. Try login now!", Toast.LENGTH_LONG).show(); // Launch login activity Intent i = new Intent( getActivity(), Login.class); startActivity(i); } else { String errorMsg = jObj.getString("error_msg"); Toast.makeText(getActivity(), errorMsg, Toast.LENGTH_LONG).show(); } } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { NetworkResponse networkResponse = error.networkResponse; if (networkResponse != null) { Log.e("Volley", "Error. HTTP Status Code:"+networkResponse.statusCode); } if (error instanceof TimeoutError) { Log.e("Volley", "TimeoutError"); }else if(error instanceof NoConnectionError){ Log.e("Volley", "NoConnectionError"); } else if (error instanceof AuthFailureError) { Log.e("Volley", "AuthFailureError"); } else if (error instanceof ServerError) { Log.e("Volley", "ServerError"); } else if (error instanceof NetworkError) { Log.e("Volley", "NetworkError"); } else if (error instanceof ParseError) { Log.e("Volley", "ParseError"); } //Log.e(TAG, "Registration Error: " + error.getMessage()); // Toast.makeText(getActivity(), // error.getMessage(), Toast.LENGTH_LONG).show(); // hideDialog(); } }) { @Override protected Map&lt;String, String&gt; getParams() { // Posting params to register url Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;(); params.put("name", name); params.put("email", email); params.put("password", password); return params; } }; int socketTimeout = 10000;//30 seconds - change to what you want RetryPolicy policy = new DefaultRetryPolicy(socketTimeout, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT); strReq.setRetryPolicy(policy); requestQueue.add(strReq); } private void showDialog() { if (!pDialog.isShowing()) pDialog.show(); } private void hideDialog() { if (pDialog.isShowing()) pDialog.dismiss(); } } </code></pre> <p>This is my php file</p> <pre><code>&lt;?php $response = array(); if (isset($_POST['name']) &amp;&amp; isset($_POST['email']) &amp;&amp; isset ($_POST['password'] )) { $name = $_POST['name']; $email = $_POST['email']; $password = $_POST['password']; require_once __DIR__ . '/db_connection.php'; $db = new DB_CONNECT(); $result = mysql_query("Insert into words(name,email,password) values('$name','$email','$password')"); if ($result) { $response["success"] = 1; $response["message"] = "Registration successfully."; echo json_encode($response); } else { $response["success"] = 0; $response["message"] = "Oops! An error occurred."; echo json_encode($response); } } else { $response["success"] = 0; $response["message"] = "Required field(s) is missing"; echo json_encode($response); } ?&gt; </code></pre> <p>My JSON response is:-</p> <pre><code>{"success":0,"message":"Required field(s) is missing"} </code></pre> <p>Can you identify the error please tell me.</p> </div>

安卓,调试时无法进入到run方法

安卓,调试时无法进入到run方法,但把该项目下生成的apk文件发送到手机并安装运行 是这样的,按下"主线程的消息"按钮,结果如下: ![图片说明](https://img-ask.csdn.net/upload/201702/19/1487455197_812710.png) 按下"从其他线程到主线程的消息"和"消息与其他线程运行从主线程的回调"按钮,结果 如下: ![图片说明](https://img-ask.csdn.net/upload/201702/19/1487455772_249075.png) 按下"消息到其他线程本身"按钮,结果如下: ![图片说明](https://img-ask.csdn.net/upload/201702/19/1487455715_41821.png) 求解释 EventHandler.java ``` package com.mytest.handlertest; import android.content.Context; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.util.Log; import android.widget.Toast; class EventHandler extends Handler { private NoLooperThread noLooperThread; private OwnLooperThread ownLooperThread; private Context context; public EventHandler(Context context,Looper looper) { super(looper); this.context=context; } public EventHandler() { super(); } @Override public void handleMessage(Message msg) { super.handleMessage(msg); Log.e("EventHandler", "当前线程id:------+>"+Thread.currentThread().getId()); Toast.makeText(context, "当前线程id:------+>"+Thread.currentThread().getId(), Toast.LENGTH_SHORT).show(); //可以根据msg.what执行不同的处理,这里没有这么做 switch(msg.what){ case 1: Log.e("EventHandler",(String)msg.obj); break; case 2: Log.e("EventHandler",(String)msg.obj); Toast.makeText(context, (String)msg.obj, Toast.LENGTH_SHORT).show(); //noLooperThread.stop(); break; case 3: //不能在非主线程的线程里面更新UI,所以这里通过Log打印收到的消息 Log.e("EventHandler", (String)msg.obj); //ownLooperThread.stop(); break; default: //不能在非主线程的线程里面更新UI,所以这里通过Log打印收到的消息 Log.e("EventHandler", (String)msg.obj); break; } } } ``` HandlerTest.java ``` package com.mytest.handlertest; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class HandlerTest extends Activity implements OnClickListener { private Button btn1,btn2,btn3,btn4,btn5,btn6; private boolean postRunnable; private EventHandler mHandler; private NoLooperThread noLooperThread; private OwnLooperThread ownLooperThread; private Handler mOtherThreadHandler; private TextView tv; private ReceiveMessageThread receiveMessageThread; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_handler_test); btn1=(Button)findViewById(R.id.b101); btn2=(Button)findViewById(R.id.b102); btn3=(Button)findViewById(R.id.b103); btn4=(Button)findViewById(R.id.b104); btn5=(Button)findViewById(R.id.b105); btn6=(Button)findViewById(R.id.b106); tv=(TextView)findViewById(R.id.tv1); btn1.setOnClickListener(this); btn2.setOnClickListener(this); btn3.setOnClickListener(this); btn4.setOnClickListener(this); btn5.setOnClickListener(this); btn6.setOnClickListener(this); receiveMessageThread=new ReceiveMessageThread(this); receiveMessageThread.start(); } @Override public void onClick(View v) { switch(v.getId()){ case R.id.b101: //主线程发送消息给自己 Looper looper; looper = Looper.myLooper(); //get the Main looper related with the main thread //如果不给任何参数的话会用当前线程对应的Looper(这里就是Main Looper)为Handler里面的成员mLooper赋值 mHandler = new EventHandler(this,looper); //mHandler = new EventHandler(); // 清除整个MessageQueue里的消息 mHandler.removeMessages(0); String obj = "This main thread's message and received by itself!"; //得到Message对象 Message m = mHandler.obtainMessage(2, 1, 1, obj); // 将Message对象送入到main thread的MessageQueue里面 mHandler.sendMessage(m); break; case R.id.b102: //other线程发送消息给主线程 postRunnable = false; noLooperThread = new NoLooperThread(this); noLooperThread.start(); break; case R.id.b103: //other thread获取它自己发送的消息 tv.setText("请看其他线程接收消息的错误级别日志"); ownLooperThread = new OwnLooperThread(this); ownLooperThread.start(); break; case R.id.b104: //other thread通过Post Runnable方式发送消息给主线程 postRunnable = true; noLooperThread = new NoLooperThread(this); noLooperThread.start(); break; case R.id.b105: //主线程发送消息给other thread if(null!=mOtherThreadHandler){ tv.setText("please look at the error level log for other thread received message from main thread"); String msgObj = "message from mainThread"; Message mainThreadMsg = mOtherThreadHandler.obtainMessage(1, 1, 1, msgObj); mOtherThreadHandler.sendMessage(mainThreadMsg); } break; case R.id.b106: finish(); break; } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.handler_test, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } ``` NoLooperThread.java ``` package com.mytest.handlertest; import android.content.Context; import android.os.Looper; import android.os.Message; import android.util.Log; import android.widget.TextView; import android.widget.Toast; class NoLooperThread extends Thread{ private Context context; private TextView tv; private boolean postRunnable; private EventHandler mNoLooperThreadHandler; public NoLooperThread(Context context) { this.context=context; } public void run() { Looper myLooper, mainLooper; myLooper = Looper.myLooper(); mainLooper = Looper.getMainLooper(); //这是一个static函数 String obj; if(myLooper == null){ mNoLooperThreadHandler = new EventHandler(context,mainLooper); obj = "NoLooperThread has no looper and handleMessage function executed in main thread!"; } else { mNoLooperThreadHandler = new EventHandler(context,myLooper); obj = "This is from NoLooperThread self and handleMessage function executed in NoLooperThread!"; } //Toast.makeText(context, obj, Toast.LENGTH_SHORT).show(); mNoLooperThreadHandler.removeMessages(0); if(false == postRunnable){ //send message to main thread Message m = mNoLooperThreadHandler.obtainMessage(2, 1, 1, obj); mNoLooperThreadHandler.sendMessage(m); Log.e("NoLooperThread", "NoLooperThread id:" + this.getId()); }else{ //下面new出来的实现了Runnable接口的对象中run函数是在Main Thread中执行,不是在NoLooperThread中执行 //注意Runnable是一个接口,它里面的run函数被执行时不会再新建一个线程 //您可以在run上加断点然后在eclipse调试中看它在哪个线程中执行 mNoLooperThreadHandler.post(new Runnable(){ @Override public void run() { Log.e("NoLooperThread","update UI through handler post runnalbe mechanism!"); // noLooerThread.stop(); } }); } } } ``` OwnLooperThread.java ``` package com.mytest.handlertest; import android.content.Context; import android.os.Looper; import android.os.Message; import android.widget.Toast; class OwnLooperThread extends Thread{ private Context context; private EventHandler mOwnLooperThreadHandler; public OwnLooperThread(Context context) { this.context=context; } public void run() { Looper.prepare(); Looper myLooper, mainLooper; myLooper = Looper.myLooper(); mainLooper = Looper.getMainLooper(); //这是一个static函数 String obj; if(myLooper == null){ mOwnLooperThreadHandler = new EventHandler(context,mainLooper); obj = "OwnLooperThread has no looper and handleMessage function executed in main thread!"; } else { mOwnLooperThreadHandler = new EventHandler(context,myLooper); obj = "This is from OwnLooperThread self and handleMessage function executed in NoLooperThread!"; } //Toast.makeText(context, obj, Toast.LENGTH_SHORT).show(); mOwnLooperThreadHandler.removeMessages(0); //给自己发送消息 Message m = mOwnLooperThreadHandler.obtainMessage(3, 1, 1, obj); mOwnLooperThreadHandler.sendMessage(m); Looper.loop(); } } ``` ReceiveMessageThread.java ``` package com.mytest.handlertest; import android.content.Context; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.util.Log; import android.widget.Toast; class ReceiveMessageThread extends Thread{ private Handler mOtherThreadHandler; private Context context; public ReceiveMessageThread(Context context) { this.context=context; } public void run() { Looper.prepare(); mOtherThreadHandler = new Handler(){ @Override public void handleMessage(Message msg) { super.handleMessage(msg); Log.e("ReceiveMessageThread", (String)msg.obj); Log.e("ReceiveMessageThread","当前线程id:----+>"+Thread.currentThread().getId()); // Toast.makeText(context, "当前线程id:----+>"+Thread.currentThread().getId(), Toast.LENGTH_SHORT).show(); } }; Looper.loop(); } } ```

android 百度地图 搜索跳转

一共有两个Activity ,第一个Activity显示地图,实现定位当前地址并输出在第一个页面的EditText里,第二个Activity是搜索页面,搜索框是EditText,ListView显示搜索结果,使用百度地图建议搜索功能。比如搜索一个万达广场,点击搜索结果后希望在第一个Activity的地图上显示当前定位地址和到万达广场的路线规划,就是起点和终点显示出来。 (这里需要起点自动获取,因为地图已经实现自动定位当前地址了,不要那种既要输入起点,又要输入终点,最后还得要点击一下确定,才会显示结果的那种无语的操作体验,整个软件是没有一个Bundle按钮的,只需要item) 现在的问题是点击第二个页面ListView里面的搜索结果万达广场,跳转到第一个页面之后没有任何反应。 谢谢各位大神哥哥姐姐~ 第一个java, package com.baidumap; import android.Manifest; import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.os.Bundle; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.Toast; import com.baidu.location.BDLocation; import com.baidu.location.BDLocationListener; import com.baidu.location.LocationClient; import com.baidu.location.LocationClientOption; import com.baidu.mapapi.SDKInitializer; import com.baidu.mapapi.map.BaiduMap; import com.baidu.mapapi.map.BitmapDescriptor; import com.baidu.mapapi.map.BitmapDescriptorFactory; import com.baidu.mapapi.map.MapStatus; import com.baidu.mapapi.map.MapStatusUpdateFactory; import com.baidu.mapapi.map.MapView; import com.baidu.mapapi.map.MarkerOptions; import com.baidu.mapapi.map.MyLocationConfiguration; import com.baidu.mapapi.map.MyLocationData; import com.baidu.mapapi.map.UiSettings; import com.baidu.mapapi.model.LatLng; import com.baidu.mapapi.search.core.SearchResult; import com.baidu.mapapi.search.poi.OnGetPoiSearchResultListener; import com.baidu.mapapi.search.poi.PoiDetailResult; import com.baidu.mapapi.search.poi.PoiIndoorResult; import com.baidu.mapapi.search.poi.PoiResult; import com.baidu.mapapi.search.poi.PoiSearch; public class MainActivity extends Activity { private MapView mMapView = null; private BaiduMap mBaidumap =null; private PoiSearch mPoiSearch = null; private EditText mTv = null; private LocationClient mLocClient; private MainActivity.MyLocationListener myListener = new MainActivity.MyLocationListener(); private int mCurrentDirection = 0; private Double lastX = 0.0; private MyLocationData locData; private float mCurrentAccracy; private double mCurrentLat = 0.0; private double mCurrentLon = 0.0; private String mCityName; boolean isFirstLoc = true; BitmapDescriptor mCurrentMarker; private SensorManager mSensorManager; private MyLocationConfiguration.LocationMode mCurrentMode; private MainActivity.DirectionSensorListener DirectionListener = new MainActivity.DirectionSensorListener(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SDKInitializer.initialize(getApplicationContext()); setContentView(R.layout.content_main); mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);//获取传感器管理服务 mCurrentMode = MyLocationConfiguration.LocationMode.NORMAL; //初始化地图 mMapView = (MapView) findViewById(R.id.mapView); mTv = (EditText) findViewById(R.id.tiaozhuan); mTv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Bundle bundle = new Bundle(); bundle.putString("userName", "zhangsan"); bundle.putInt("userAge", 100); Intent intent = new Intent(MainActivity.this, Main2Activity.class); intent.putExtras(bundle); startActivityForResult(intent, 1);// } }); /*protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub switch (requestCode){ case RESULT_OK: Bundle bundle=data.getExtras(); String str=bundle.getString("backData"); Toast.makeText(MainActivity.this, str,Toast.LENGTH_LONG).show(); break; default: break; }*/ mBaidumap = mMapView.getMap(); mMapView.showScaleControl(false); mMapView.showZoomControls(false); UiSettings settings = mBaidumap.getUiSettings(); settings.setOverlookingGesturesEnabled(false);//设置双指下拉时不启用3D地图 settings.setRotateGesturesEnabled(false);//设置地图不可旋转 //开启定位图层 mBaidumap.setMyLocationEnabled(true); initLocation(); //initPoiSearch(); mPoiSearch = PoiSearch.newInstance(); mPoiSearch.setOnGetPoiSearchResultListener(new OnGetPoiSearchResultListener() { @Override public void onGetPoiDetailResult(PoiDetailResult poiDetailResult) { if (poiDetailResult == null || poiDetailResult.error == SearchResult.ERRORNO.RESULT_NOT_FOUND) { Toast.makeText(MainActivity.this, "未找到结果", Toast.LENGTH_LONG) .show(); return; } if (poiDetailResult.error == SearchResult.ERRORNO.NO_ERROR) { //搜索到POI mBaidumap.clear(); mBaidumap.addOverlay(new MarkerOptions() .position(poiDetailResult.location) .icon(BitmapDescriptorFactory.fromResource(R.drawable.alf)) .title(poiDetailResult.getAddress())); //讲该POI设置为地图中心 mBaidumap.setMapStatus(MapStatusUpdateFactory.newLatLng(poiDetailResult.location)); Toast.makeText(MainActivity.this, "搜索中...", Toast.LENGTH_LONG).show(); return; } } @Override public void onGetPoiIndoorResult(PoiIndoorResult poiIndoorResult) { } @Override public void onGetPoiResult(PoiResult poiResult) { } }); } private void initLocation() { mLocClient = new LocationClient(this); mLocClient.registerLocationListener(myListener); LocationClientOption option = new LocationClientOption(); option.setOpenGps(true);//打开GPS option.setCoorType("bd09ll");//设置坐标类型 option.setIsNeedAddress(true);//是否需要地址信息 option.setScanSpan(1000); LocationPermission(); mLocClient.setLocOption(option); } private void LocationPermission() { int checkPermission = ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.ACCESS_COARSE_LOCATION); if (checkPermission != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 1); Log.d("未获得定位权限", "弹出提示"); return; } } public class DirectionSensorListener implements SensorEventListener { @Override public void onSensorChanged(SensorEvent event) { double x = event.values[SensorManager.DATA_X]; if (Math.abs(x - lastX) > 1.0) { mCurrentDirection = (int) x; //设置定位数据 locData = new MyLocationData.Builder() .accuracy(mCurrentAccracy)//精度 .direction(mCurrentDirection) //此处设置开发者获取到的方向信息,顺时针0-360 .latitude(mCurrentLat)//经度 .longitude(mCurrentLon)//纬度 .build(); mBaidumap.setMyLocationData(locData); } lastX = x; } @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { } } public class MyLocationListener implements BDLocationListener { @Override public void onReceiveLocation(BDLocation bdLocation) { //map view销毁后不在处理新接受的位置 if (bdLocation == null || mMapView == null) { return; } mCurrentLat = bdLocation.getLatitude(); mCurrentLon = bdLocation.getLongitude(); mCurrentAccracy = bdLocation.getRadius(); mCityName = bdLocation.getCity(); //设置定位数据 locData = new MyLocationData.Builder() .accuracy(bdLocation.getRadius())//精度 .direction(mCurrentDirection) //此处设置开发者获取到的方向信息,顺时针0-360 .latitude(bdLocation.getLatitude())//经度 .longitude(bdLocation.getLongitude())//纬度 .build(); mBaidumap.setMyLocationData(locData); //第一次定位时,将地图位置移动到当前位置 if (isFirstLoc) { isFirstLoc = false; LatLng ll = new LatLng(bdLocation.getLatitude(), bdLocation.getLongitude()); MapStatus.Builder builder = new MapStatus.Builder(); builder.target(ll).zoom(18.0f); mBaidumap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); mCurrentMarker = null; mBaidumap .setMyLocationConfiguration(new MyLocationConfiguration( mCurrentMode, true, null)); } } } @Override protected void onStart() { //为系统的方向传感器注册监听器 mSensorManager.registerListener(DirectionListener, mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION) , SensorManager.SENSOR_DELAY_UI); //启动监听 mLocClient.start(); super.onStart(); } @Override protected void onPause() { mMapView.onPause(); super.onPause(); } @Override protected void onResume() { mMapView.onResume(); super.onResume(); } @Override protected void onStop() { //取消传感器监听 mSensorManager.unregisterListener(DirectionListener); super.onStop(); } @Override protected void onDestroy() { //退出时销毁定位 mLocClient.stop(); //关闭定位图层 mBaidumap.setMyLocationEnabled(false); mMapView.onDestroy(); //mMapView = null; // mPoiSearch.destroy(); //mSuggestionSearch.destroy(); super.onDestroy(); } } 第二个java, package com.baidumap; import android.Manifest; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.os.Bundle; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.AdapterView; import android.widget.EditText; import android.widget.ListView; import android.widget.Toast; import com.baidu.location.BDLocation; import com.baidu.location.BDLocationListener; import com.baidu.location.LocationClient; import com.baidu.location.LocationClientOption; import com.baidu.mapapi.SDKInitializer; import com.baidu.mapapi.map.BaiduMap; import com.baidu.mapapi.map.BitmapDescriptor; import com.baidu.mapapi.map.BitmapDescriptorFactory; import com.baidu.mapapi.map.MapStatus; import com.baidu.mapapi.map.MapStatusUpdateFactory; import com.baidu.mapapi.map.MapView; import com.baidu.mapapi.map.MarkerOptions; import com.baidu.mapapi.map.MyLocationConfiguration; import com.baidu.mapapi.map.MyLocationConfiguration.LocationMode; import com.baidu.mapapi.map.MyLocationData; import com.baidu.mapapi.map.UiSettings; import com.baidu.mapapi.model.LatLng; import com.baidu.mapapi.search.core.CityInfo; import com.baidu.mapapi.search.core.SearchResult; import com.baidu.mapapi.search.poi.OnGetPoiSearchResultListener; import com.baidu.mapapi.search.poi.PoiDetailResult; import com.baidu.mapapi.search.poi.PoiDetailSearchOption; import com.baidu.mapapi.search.poi.PoiIndoorResult; import com.baidu.mapapi.search.poi.PoiResult; import com.baidu.mapapi.search.poi.PoiSearch; import com.baidu.mapapi.search.sug.OnGetSuggestionResultListener; import com.baidu.mapapi.search.sug.SuggestionResult; import com.baidu.mapapi.search.sug.SuggestionSearch; import com.baidu.mapapi.search.sug.SuggestionSearchOption; import java.util.ArrayList; import java.util.List; import java.util.Timer; import java.util.TimerTask; public class Main2Activity extends Activity implements OnGetSuggestionResultListener { private EditText et_address; private Adapter_list_Address adapter_list_Address; private ListView myListView; private List<String> list = new ArrayList<>(); private List<String> lists = new ArrayList<>(); //地图相关 /** * 百度地图控件 */ MapView mMapView = null; /** * 百度地图实例 */ BaiduMap mBaidumap = null; //定位相关 /** * 定位客户端 */ LocationClient mLocClient; /** * 定位模式 */ private LocationMode mCurrentMode; /** * 定位图标 */ BitmapDescriptor mCurrentMarker; /** * 传感器管理器 */ private SensorManager mSensorManager; /** * 当前方向 */ private int mCurrentDirection = 0; /** * 当前经度 */ private double mCurrentLat = 0.0; /** * 当前纬度 */ private double mCurrentLon = 0.0; /** * 当前经度 */ private float mCurrentAccracy; /** * 是否首次定位 */ boolean isFirstLoc = true; /** * 定位数据 */ private MyLocationData locData; /** * 定位监听 */ private MyLocationListener myListener = new MyLocationListener(); /** * 方向监听 */ private DirectionSensorListener DirectionListener = new DirectionSensorListener(); /** * 上一次的方向 */ private Double lastX = 0.0; /** * 定位所在城市 */ private String mCityName; //poi搜索相关 /** * Poi检索实例 */ private PoiSearch mPoiSearch = null; private SuggestionSearch mSuggestionSearch = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SDKInitializer.initialize(getApplicationContext()); setContentView(R.layout.activity_main2); mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);//获取传感器管理服务 mCurrentMode = LocationMode.NORMAL; //初始化地图 mMapView = (MapView) findViewById(R.id.mapView2); mBaidumap = mMapView.getMap(); mMapView.showScaleControl(false); mMapView.showZoomControls(false); UiSettings settings = mBaidumap.getUiSettings(); settings.setOverlookingGesturesEnabled(false);//设置双指下拉时不启用3D地图 settings.setRotateGesturesEnabled(false);//设置地图不可旋转 //开启定位图层 mBaidumap.setMyLocationEnabled(true); initLocation(); initPoiSearch(); initData(); Timer timer = new Timer(); timer.schedule(new TimerTask() { public void run() { ShowKeyboard(et_address); } }, 500); } private void initData() { et_address = (EditText) findViewById(R.id.et_address); myListView = (ListView) findViewById(R.id.lv_address); mPoiSearch = PoiSearch.newInstance(); mPoiSearch.setOnGetPoiSearchResultListener(new OnGetPoiSearchResultListener() { @Override public void onGetPoiResult(PoiResult poiResult) { if (poiResult == null || poiResult.error == SearchResult.ERRORNO.RESULT_NOT_FOUND) { Toast.makeText(Main2Activity.this, "未找到结果", Toast.LENGTH_LONG).show(); return; } if (poiResult.error == SearchResult.ERRORNO.NO_ERROR) { } if (poiResult.error == SearchResult.ERRORNO.AMBIGUOUS_KEYWORD) { //当输入关键字在本市没有找到,但是在其他城市找到时,返回包含该关键字信息的城市列表 String strInfo = "在"; for (CityInfo cityInfo : poiResult.getSuggestCityList()) { strInfo += cityInfo.city; strInfo += ","; } strInfo += "找到结果"; Toast.makeText(Main2Activity.this, strInfo, Toast.LENGTH_LONG).show(); } } @Override public void onGetPoiDetailResult(PoiDetailResult poiDetailResult) { if (poiDetailResult == null || poiDetailResult.error == SearchResult.ERRORNO.RESULT_NOT_FOUND) { Toast.makeText(Main2Activity.this, "未找到结果", Toast.LENGTH_LONG) .show(); return; } if (poiDetailResult.error == SearchResult.ERRORNO.NO_ERROR) { //搜索到POI mBaidumap.clear(); mBaidumap.addOverlay(new MarkerOptions() .position(poiDetailResult.location) .icon(BitmapDescriptorFactory.fromResource(R.drawable.alf)) .title(poiDetailResult.getAddress())); //讲该POI设置为地图中心 mBaidumap.setMapStatus(MapStatusUpdateFactory.newLatLng(poiDetailResult.location)); Toast.makeText(Main2Activity.this, "搜索中...", Toast.LENGTH_LONG).show(); return; } } @Override public void onGetPoiIndoorResult(PoiIndoorResult poiIndoorResult) { } }); //初始化建议搜索模块,注册建议搜索事件监听 mSuggestionSearch = SuggestionSearch.newInstance(); mSuggestionSearch.setOnGetSuggestionResultListener(this); et_address.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable arg0) { if (adapter_list_Address != null) { adapter_list_Address.notifyDataSetChanged(); } mSuggestionSearch .requestSuggestion((new SuggestionSearchOption()) .keyword(et_address.getText().toString()).city("北京")); } @Override public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { if (adapter_list_Address != null) { adapter_list_Address.notifyDataSetChanged(); } mSuggestionSearch .requestSuggestion((new SuggestionSearchOption()) .keyword(et_address.getText().toString()).city("北京")); } @Override public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) { if (cs.length() < 0) { return; } /** * 使用建议搜索服务获取建议列表,结果在onSuggestionResult()中更新 */ if (adapter_list_Address != null) { adapter_list_Address.notifyDataSetChanged(); } mSuggestionSearch .requestSuggestion((new SuggestionSearchOption()) .keyword(et_address.getText().toString()).city("北京")); } }); } @Override public void onGetSuggestionResult(final SuggestionResult msg) { // TODO Auto-generated method stub if (msg == null || msg.getAllSuggestions() == null) { Toast.makeText(Main2Activity.this, "未检索到当前地址", Toast.LENGTH_SHORT).show(); return; } if (list != null) { list.clear(); } if (lists != null) { lists.clear(); } for (SuggestionResult.SuggestionInfo info : msg.getAllSuggestions()) { Log.e("info.ccity", "info.city" + info.city + "info.district" + info.district + "info.key" + info.key); list.add(info.key); lists.add(info.city + info.district + info.key); adapter_list_Address = new Adapter_list_Address(Main2Activity.this, list, lists); myListView.setAdapter(adapter_list_Address); myListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { SuggestionResult.SuggestionInfo info = msg.getAllSuggestions().get(position); mPoiSearch.searchPoiDetail(new PoiDetailSearchOption().poiUid(info.uid)); Intent intentAddress = new Intent(); intentAddress.putExtra("backData",et_address.getText().toString()); setResult(RESULT_OK,intentAddress); finish(); } }); adapter_list_Address.notifyDataSetChanged(); } } public static void ShowKeyboard(View v) { InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(v, InputMethodManager.SHOW_FORCED); } public static void HideKeyboard(View v) { InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); if (imm.isActive()) { imm.hideSoftInputFromWindow(v.getApplicationWindowToken(), 0); } } /** * 初始化定位相关 */ private void initLocation() { mLocClient = new LocationClient(this); mLocClient.registerLocationListener(myListener); LocationClientOption option = new LocationClientOption(); option.setOpenGps(true);//打开GPS option.setCoorType("bd09ll");//设置坐标类型 option.setIsNeedAddress(true);//是否需要地址信息 option.setScanSpan(1000); LocationPermission(); mLocClient.setLocOption(option); } /** * poi搜索相关 */ private void initPoiSearch() { //初始化搜索模块,注册搜索事件监听 mPoiSearch = PoiSearch.newInstance(); //mPoiSearch.setOnGetPoiSearchResultListener(this); } /** * 获取GPS定位权限(Android6.0 以上需要动态获取权限) */ private void LocationPermission() { int checkPermission = ContextCompat.checkSelfPermission(Main2Activity.this, Manifest.permission.ACCESS_COARSE_LOCATION); if (checkPermission != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(Main2Activity.this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 1); Log.d("未获得定位权限", "弹出提示"); return; } } /** * 方向监听 */ public class DirectionSensorListener implements SensorEventListener { @Override public void onSensorChanged(SensorEvent event) { double x = event.values[SensorManager.DATA_X]; if (Math.abs(x - lastX) > 1.0) { mCurrentDirection = (int) x; //设置定位数据 locData = new MyLocationData.Builder() .accuracy(mCurrentAccracy)//精度 .direction(mCurrentDirection) //此处设置开发者获取到的方向信息,顺时针0-360 .latitude(mCurrentLat)//经度 .longitude(mCurrentLon)//纬度 .build(); mBaidumap.setMyLocationData(locData); } lastX = x; } @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { } } /** * 定位监听 */ public class MyLocationListener implements BDLocationListener { @Override public void onReceiveLocation(BDLocation bdLocation) { //map view销毁后不在处理新接受的位置 if (bdLocation == null || mMapView == null) { return; } mCurrentLat = bdLocation.getLatitude(); mCurrentLon = bdLocation.getLongitude(); mCurrentAccracy = bdLocation.getRadius(); mCityName = bdLocation.getCity(); //设置定位数据 locData = new MyLocationData.Builder() .accuracy(bdLocation.getRadius())//精度 .direction(mCurrentDirection) //此处设置开发者获取到的方向信息,顺时针0-360 .latitude(bdLocation.getLatitude())//经度 .longitude(bdLocation.getLongitude())//纬度 .build(); mBaidumap.setMyLocationData(locData); //第一次定位时,将地图位置移动到当前位置 if (isFirstLoc) { isFirstLoc = false; LatLng ll = new LatLng(bdLocation.getLatitude(), bdLocation.getLongitude()); MapStatus.Builder builder = new MapStatus.Builder(); builder.target(ll).zoom(18.0f); mBaidumap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); mCurrentMarker = null; mBaidumap .setMyLocationConfiguration(new MyLocationConfiguration( mCurrentMode, true, null)); } } } @Override protected void onStart() { //为系统的方向传感器注册监听器 mSensorManager.registerListener(DirectionListener, mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION) , SensorManager.SENSOR_DELAY_UI); //启动监听 mLocClient.start(); super.onStart(); } @Override protected void onPause() { mMapView.onPause(); super.onPause(); } @Override protected void onResume() { mMapView.onResume(); super.onResume(); } @Override protected void onStop() { //取消传感器监听 mSensorManager.unregisterListener(DirectionListener); super.onStop(); } @Override protected void onDestroy() { //退出时销毁定位 mLocClient.stop(); //关闭定位图层 mBaidumap.setMyLocationEnabled(false); mMapView.onDestroy(); mMapView = null; mPoiSearch.destroy(); mSuggestionSearch.destroy(); super.onDestroy(); } }

activiti启动实例时异常,大神们能看出什么原因吗 ?

12:26:46.846 [main] INFO o.a.engine.impl.db.DbSqlSession 1147 - performing create on identity with resource org/activiti/db/create/activiti.h2.create.identity.sql 12:26:46.862 [main] INFO o.a.engine.impl.ProcessEngineImpl 87 - ProcessEngine default created 12:26:47.596 [main] WARN o.a.e.i.b.d.ProcessDefinitionDiagramHelper 67 - Error while generating process diagram, image will not be stored in repository java.lang.NullPointerException: null at org.activiti.image.impl.DefaultProcessDiagramGenerator.connectionPerfectionizer(DefaultProcessDiagramGenerator.java:697) at org.activiti.image.impl.DefaultProcessDiagramGenerator$22.draw(DefaultProcessDiagramGenerator.java:379) at org.activiti.image.impl.DefaultProcessDiagramGenerator.drawArtifact(DefaultProcessDiagramGenerator.java:785) at org.activiti.image.impl.DefaultProcessDiagramGenerator.generateProcessDiagram(DefaultProcessDiagramGenerator.java:508) at org.activiti.image.impl.DefaultProcessDiagramGenerator.generateDiagram(DefaultProcessDiagramGenerator.java:403) at org.activiti.image.impl.DefaultProcessDiagramGenerator.generateDiagram(DefaultProcessDiagramGenerator.java:427) at org.activiti.engine.impl.bpmn.deployer.ProcessDefinitionDiagramHelper.createDiagramForProcessDefinition(ProcessDefinitionDiagramHelper.java:51) at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.createAndPersistNewDiagramsIfNeeded(BpmnDeployer.java:117) at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.deploy(BpmnDeployer.java:79) at org.activiti.engine.impl.persistence.deploy.DeploymentManager.deploy(DeploymentManager.java:60) at org.activiti.engine.impl.cmd.DeployCmd.executeDeploy(DeployCmd.java:110) at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:60) at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:40) at org.activiti.engine.impl.interceptor.CommandInvoker$1.run(CommandInvoker.java:37) at org.activiti.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:78) at org.activiti.engine.impl.interceptor.CommandInvoker.executeOperations(CommandInvoker.java:57) at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:42) at org.activiti.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:48) at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:63) at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45) at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:29) at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:44) at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:39) at org.activiti.engine.impl.RepositoryServiceImpl.deploy(RepositoryServiceImpl.java:86) at org.activiti.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:188) at org.activiti.engine.impl.test.TestHelper.annotationDeploymentSetUp(TestHelper.java:101) at org.activiti.engine.test.ActivitiRule.starting(ActivitiRule.java:215) at org.activiti.engine.test.ActivitiRule.startingQuietly(ActivitiRule.java:159) at org.activiti.engine.test.ActivitiRule.access$000(ActivitiRule.java:76) at org.activiti.engine.test.ActivitiRule$1.evaluate(ActivitiRule.java:114) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:254) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:193) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) ProcessEngine [default] Version: [6.0.0.4] Found process definition [Text FlowChart2] with id [TextFlowChart2:1:3]

Android使用Xutils3下载安装apk报错问题,求解

1.根据xutils3的文档说明,创建了一个类对xutils进行初始化 ``` public class MyApp extends Application { @Override public void onCreate() { super.onCreate(); x.Ext.init(this); x.Ext.setDebug(false); } } ``` 2.然后在配置文件中做了如下配置 ``` <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.gao.mysafe"> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.INSTALL_PACKAGES" tools:ignore="ProtectedPermissions" /> <application android:name=".MyApp" android:allowBackup="true" android:icon="@mipmap/safe_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".SplashActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".MainActivity"></activity> </application> </manifest> ``` 3.在activity中调用了xutils的下载方法 ``` //apk下载地址,放置apk的路径 //1.获取sd卡路径 String path = Environment.getExternalStorageDirectory().getPath() + "/mysafe.apk"; //2.发送请求,获取apk,并放到指定路径 RequestParams rp = new RequestParams(url); rp.setSaveFilePath(path); rp.setAutoRename(true); x.http().get(rp, new Callback.ProgressCallback<File>() { //下载成功 @Override public void onSuccess(File result) { ToastUtils.show(SplashActivity.this, "下载成功,开始安装!!"); installAPK(result); } //下载出现问题 @Override public void onError(Throwable ex, boolean isOnCallback) { } @Override public void onCancelled(CancelledException cex) { } @Override public void onFinished() { } @Override public void onWaiting() { } //刚刚开始下载 @Override public void onStarted() { } //下载过程中方法 @Override public void onLoading(long total, long current, boolean isDownloading) { } }); ``` 然后在模拟器中出现了如下问题 ``` D/dalvikvm: Not late-enabling CheckJNI (already on) I/InstantRun: Instant Run Runtime started. Android package is com.gao.mysafe, real application class is com.gao.mysafe.MyApp. W/InstantRun: No instant run dex files added to classpath D/dalvikvm: GC_FOR_ALLOC freed 68K, 5% free 2929K/3056K, paused 2ms, total 3ms I/dalvikvm-heap: Grow heap (frag case) to 34.554MB for 33177612-byte allocation D/dalvikvm: GC_FOR_ALLOC freed <1K, 1% free 35328K/35460K, paused 5ms, total 5ms D/OpenGLRenderer: Enabling debug mode 0 I/dalvikvm: Could not find method android.view.Window$Callback.onProvideKeyboardShortcuts, referenced from method android.support.v7.view.WindowCallbackWrapper.onProvideKeyboardShortcuts W/dalvikvm: VFY: unable to resolve interface method 16550: Landroid/view/Window$Callback;.onProvideKeyboardShortcuts (Ljava/util/List;Landroid/view/Menu;I)V D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002 W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;) I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested W/dalvikvm: VFY: unable to resolve interface method 16552: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002 I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode W/dalvikvm: VFY: unable to resolve interface method 16556: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode; D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002 I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.widget.TintTypedArray.getChangingConfigurations W/dalvikvm: VFY: unable to resolve virtual method 747: Landroid/content/res/TypedArray;.getChangingConfigurations ()I D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002 I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType W/dalvikvm: VFY: unable to resolve virtual method 769: Landroid/content/res/TypedArray;.getType (I)I D/dalvikvm: VFY: replacing opcode 0x6e at 0x0008 I/dalvikvm: Could not find method android.content.res.Resources.getDrawable, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawable W/dalvikvm: VFY: unable to resolve virtual method 710: Landroid/content/res/Resources;.getDrawable (ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable; D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002 I/dalvikvm: Could not find method android.content.res.Resources.getDrawableForDensity, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawableForDensity W/dalvikvm: VFY: unable to resolve virtual method 712: Landroid/content/res/Resources;.getDrawableForDensity (IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable; D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002 E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering W/dalvikvm: VFY: unable to resolve instanceof 158 (Landroid/graphics/drawable/RippleDrawable;) in Landroid/support/v7/widget/AppCompatImageHelper; D/dalvikvm: VFY: replacing opcode 0x20 at 0x000c I/dalvikvm: Could not find method android.content.Context.getColorStateList, referenced from method android.support.v7.content.res.AppCompatResources.getColorStateList W/dalvikvm: VFY: unable to resolve virtual method 470: Landroid/content/Context;.getColorStateList (I)Landroid/content/res/ColorStateList; D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006 ``` 4.调用安装方法后也出现了错误 ``` private void installAPK(File file) { //系统应用界面,源码,安装apk入口 Intent intent = new Intent(Intent.ACTION_VIEW); intent.addCategory("android.intent.category.DEFAULT"); //文件作为数据源 intent.setData(Uri.fromFile(file)); //设置安装类型 intent.setType("application/vnd.android.package-archive"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); /* 也可以用下面代码一行完成 intent.setDataAndType(Uri.fromFile(file),"application/vnd.android.package-archive"); */ try{ startActivityForResult(intent, 0); }catch (Exception e){ e.printStackTrace(); } } ``` 问题如下: ``` D/dalvikvm: GC_FOR_ALLOC freed 422K, 2% free 36957K/37436K, paused 3ms, total 3ms W/System.err: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW cat=[android.intent.category.DEFAULT] typ=application/vnd.android.package-archive flg=0x10000000 } W/System.err: at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1632) W/System.err: at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424) W/System.err: at android.app.Activity.startActivityForResult(Activity.java:3424) W/System.err: at android.app.Activity.startActivityForResult(Activity.java:3385) W/System.err: at com.gao.mysafe.SplashActivity.installAPK(SplashActivity.java:338) W/System.err: at com.gao.mysafe.SplashActivity.access$500(SplashActivity.java:30) W/System.err: at com.gao.mysafe.SplashActivity$6.onSuccess(SplashActivity.java:280) W/System.err: at com.gao.mysafe.SplashActivity$6.onSuccess(SplashActivity.java:275) W/System.err: at org.xutils.http.HttpTask.onSuccess(HttpTask.java:447) W/System.err: at org.xutils.common.task.TaskProxy$InternalHandler.handleMessage(TaskProxy.java:198) W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102) W/System.err: at android.os.Looper.loop(Looper.java:136) W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5017) W/System.err: at java.lang.reflect.Method.invokeNative(Native Method) W/System.err: at java.lang.reflect.Method.invoke(Method.java:515) W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) W/System.err: at dalvik.system.NativeStart.main(Native Method) ``` 弄了半天不知道是什么问题,在真机上也不好使,安装不上,求大神解答一下,谢谢了!!

appium 测试无法打开 app,请各位大神帮忙

初学appium,使用python写测试脚本,现在可以安装上app,之后无法自动启动app。 这是我的脚本: #coding=utf-8 from appium import webdriver from lib2to3.pgen2.driver import Driver from lib2to3.tests.support import driver import os import time PATH=lambda p:os.path.abspath(os.path.join(os.path.dirname(file),p)) global driver desired_caps = {} desired_caps['platformName'] = 'Android' desired_caps['platformVersion'] = '4.4.2' desired_caps['deviceName'] = 'b91b9b66' #desired_caps['appPackage'] = 'com.zhengyuan.watch' #desired_caps['appActivity'] = 'com.zhengyuan.watch.logic.launch.AppStart' desired_caps['app'] = PATH('D:\android\app\rtring_c_zhengyuan.apk') driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) time.sleep(5) driver.swipe(600,660,10,660,1000) time.sleep(1) driver.swipe(600,660,10,660,1000) time.sleep(1) log: info: --> POST /wd/hub/session {"desiredCapabilities":{"platformVersion":"4.4.2","deviceName":"b91b9b66","app":"D:\android\app\rtring_c_zhengyuan.apk","platformName":"Android"}} info: Client User-Agent string: Python-urllib/2.7 info: [debug] No appActivity desired capability or server param. Parsing from apk. info: [debug] No appPackage desired capability or server param. Parsing from apk. info: [debug] Using local app from desired caps: D:\android\app\rtring_c_zhengyuan.apk info: [debug] Creating new appium session 7ab051a1-8c95-4b9a-a998-f1748ed52d47 info: Starting android appium info: [debug] Getting Java version info: Java version is: 1.7.0_79 info: [debug] Checking whether adb is present info: [debug] Using adb from D:\android\sdk\platform-tools\adb.exe info: [debug] Parsing package and activity from app manifest info: [debug] Checking whether aapt is present info: [debug] Using aapt from D:\android\sdk\build-tools\android-4.4W\aapt.exe info: [debug] Extracting package and launch activity from manifest. info: [debug] executing cmd: D:\android\sdk\build-tools\android-4.4W\aapt.exe dump badging D:\android\app\rtring_c_zhengyuan.apk info: [debug] badging package: com.zhengyuan.watch info: [debug] badging act: com.zhengyuan.watch.logic.launch.AppStart info: [debug] Parsed package and activity are: com.zhengyuan.watch/com.zhengyuan.watch.logic.launch.AppStart info: [debug] Using fast reset? true info: [debug] Preparing device for session info: [debug] Checking whether app is actually present info: Retrieving device info: [debug] Trying to find a connected android device info: [debug] Getting connected devices... info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe devices info: [debug] 1 device(s) connected info: Found device b91b9b66 info: [debug] Setting device id to b91b9b66 info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5) info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 wait-for-device info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "echo 'ready'" info: [debug] Starting logcat capture info: [debug] Getting device API level info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "getprop ro.build.version.sdk" info: [debug] Device is at API Level 19 info: Device API level is: 19 info: [debug] Extracting strings for language: default info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "getprop persist.sys.language" info: [debug] Current device persist.sys.language: zh info: [debug] java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "D:\android\app\rtring_c_zhengyuan.apk" "C:\Users\admin\AppData\Local\Temp\com.zhengyuan.watch" zh info: [debug] Reading strings from converted strings.json info: [debug] Setting language to default info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 push "C:\Users\admin\AppData\Local\Temp\com.zhengyuan.watch\strings.json" /data/local/tmp info: [debug] Checking whether aapt is present info: [debug] Using aapt from D:\android\sdk\build-tools\android-4.4W\aapt.exe info: [debug] Retrieving process from manifest. info: [debug] executing cmd: D:\android\sdk\build-tools\android-4.4W\aapt.exe dump xmltree D:\android\app\rtring_c_zhengyuan.apk AndroidManifest.xml info: [debug] Set app process to: com.zhengyuan.watch info: [debug] Not uninstalling app since server not started with --full-reset info: [debug] Checking app cert for D:\android\app\rtring_c_zhengyuan.apk. info: [debug] executing cmd: java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar" D:\android\app\rtring_c_zhengyuan.apk info: [debug] App already signed. info: [debug] Zip-aligning D:\android\app\rtring_c_zhengyuan.apk info: [debug] Checking whether zipalign is present info: [debug] Using zipalign from D:\android\sdk\build-tools\android-4.4W\zipalign.exe info: [debug] Zip-aligning apk. info: [debug] executing cmd: D:\android\sdk\build-tools\android-4.4W\zipalign.exe -f 4 D:\android\app\rtring_c_zhengyuan.apk C:\Users\admin\AppData\Local\Temp\116210-428-1fgurq6\appium.tmp info: [debug] MD5 for app is 310a577ec209ceac8a6dee5086a1bf5d info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "ls /data/local/tmp/310a577ec209ceac8a6dee5086a1bf5d.apk" info: [debug] Getting install status for com.zhengyuan.watch info: [debug] Getting device API level info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "getprop ro.build.version.sdk" info: [debug] Device is at API Level 19 info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "pm list packages -3 com.zhengyuan.watch" info: [debug] App is installed info: Installing App info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "mkdir -p /data/local/tmp/" info: [debug] Removing any old apks info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "ls /data/local/tmp/*.apk" info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell rm "/data/local/tmp/8f29ab35c86ad03708a23dfe9aaeeaa0.apk" info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 push "D:\android\app\rtring_c_zhengyuan.apk" /data/local/tmp/310a577ec209ceac8a6dee5086a1bf5d.apk info: [debug] Uninstalling com.zhengyuan.watch info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "am force-stop com.zhengyuan.watch" info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 uninstall com.zhengyuan.watch info: [debug] App was uninstalled info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "pm install -r /data/local/tmp/310a577ec209ceac8a6dee5086a1bf5d.apk" info: [debug] Forwarding system:4724 to device:4724 info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 forward tcp:4724 tcp:4724 info: [debug] Pushing appium bootstrap to device... info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 push "C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/ info: [debug] Pushing settings apk to device... info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 install "C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk" info: [debug] Pushing unlock helper app to device... info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 install "C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk" info: Starting App info: [debug] Attempting to kill all 'uiautomator' processes info: [debug] Getting all processes with 'uiautomator' info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "ps 'uiautomator'" info: [debug] Attempting to kill process 31936 info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "kill 31936" info: [debug] Running bootstrap info: [debug] spawning: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.zhengyuan.watch -e disableAndroidWatchers false info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1 info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream= info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap: info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1 info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1 info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724 info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready info: [debug] [BOOTSTRAP] [debug] Loading json... error: Unhandled error: Error: getaddrinfo ENOENT at Object.exports.errnoException (util.js:746:11) at errnoException (dns.js:49:15) at GetAddrInfoReqWrap.onlookup as oncomplete context: [POST /wd/hub/session {"desiredCapabilities":{"platformVersion":"4.4.2","deviceName":"b91b9b66","app":"D:\android\app\rtringc_zhengyuan.apk","platformName":"Android"}}] info: [debug] [BOOTSTRAP] [debug] json loading complete. info: [debug] [BOOTSTRAP] [debug] Registered crash watchers. info: <-- POST /wd/hub/session - - ms - - undefined 之后就停住了,请大家帮我看看是什么问题,纠结了好几天了,谢谢大家!

android 无法转换为android.support.v4.app.Fragment

程序抛出错误: 不兼容的类型: android.app.Fragment无法转换为android.support.v4.app.Fragment Error:(34, 47) 错误: 不兼容的类型: android.app.Fragment无法转换为android.support.v4.app.Fragment Error:Execution failed for task ':app:compileDebugJavaWithJavac'. > Compilation failed; see the compiler error output for details. ``` package fragment.example.com.fragmenttest; import android.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class MainActivity extends AppCompatActivity implements View.OnClickListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button = (Button) findViewById(R.id.button); button.setOnClickListener(this); replaceFragment(new RightFragment()); } @Override public void onClick(View v){ switch (v.getId()){ case R.id.button: replaceFragment(new AnotherRightFragment()); break; default:break; } } private void replaceFragment(Fragment fragment) { FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.replace(R.id.right_layout,fragment); transaction.commit(); } } ``` 报错位置是 transaction.replace(R.id.right_layout,fragment);的fragment

dubbo报错,这是没连上服务还是什么情况?

java.lang.NullPointerException at cn.js189.marketing.service.util.toolnumbers.CallCurrAcuReq.get20114Flow(CallCurrAcuReq.java:63) at cn.js189.marketing.service.floworder.impl.RechargeHistoryServiceImpl.queryCumUlationDeal(RechargeHistoryServiceImpl.java:63) at cn.js189.marketing.service.activity.impl.FlowSendServiceImpl.checkOrderPacket(FlowSendServiceImpl.java:279) at cn.js189.marketing.service.activity.impl.FlowSendServiceImpl.sendDeliveryNew(FlowSendServiceImpl.java:1111) at cn.js189.marketing.service.activity.impl.FlowSendServiceImpl$$FastClassBySpringCGLIB$$f55e4e7.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673) at cn.js189.marketing.service.activity.impl.FlowSendServiceImpl$$EnhancerBySpringCGLIB$$7e225be0.sendDeliveryNew(<generated>) at cn.js189.marketing.activity.controller.FlowSendController.sendDeliveryNew(FlowSendController.java:236) at cn.js189.marketing.activity.controller.FlowSendController$$FastClassBySpringCGLIB$$7b69cb15.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673) at cn.js189.marketing.activity.controller.FlowSendController$$EnhancerBySpringCGLIB$$b6c9b259.sendDeliveryNew(<generated>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) at javax.servlet.http.HttpServlet.service(HttpServlet.java:650) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:743) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:410) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337) at cn.js189.common.filters.PathFilter.doFilter(PathFilter.java:103) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at cn.js189.common.filters.ParseFilter.doFilter(ParseFilter.java:112) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745)

检索 item 父节点时出错: 没有发现与升级到 AppCompat v23后给定名称匹配的资源

<div class="post-text" itemprop="text"> <p>I've always programmed Android with Eclipse and decided to start migrating to <a href="https://en.wikipedia.org/wiki/Android_Studio" rel="noreferrer">Android Studio</a>. I decided to use the same SDK I already had for Eclipse, then:</p> <ul> <li>Started a new project</li> <li>Set minimum SDK 4.0 (API Level 14)</li> <li>Choose Blank Activity option</li> <li>Used Default names for Activity Name and Layout Name</li> <li>Hit Finish</li> </ul> <p>After a few seconds Gradle finishes the build, and it throws me two errors with the following messages in file Teste4\app\build\intermediates/exploded-aar\com.android.support\appcompat-v7\23.0.0\res\values-v23\values-v23.xml:</p> <blockquote> <p>Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. <br> <br> Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'. <br></p> </blockquote> <p>Under <em>File -&gt; Project Structure -&gt; Modules: app (left column) -&gt; Properties tab</em>, I have the following versions set up:</p> <ul> <li>"Compile Sdk Version": Android 5.1 (API Level 22)</li> <li>"Build Tools Version": 23.0.2</li> </ul> <p>What should I do in order to fix this?</p> <p>I already tried what was suggested in Stack Overflow question <em><a href="https://stackoverflow.com/questions/26431676">appcompat-v7:21.0.0': No resource found that matches the given name: attr 'android:actionModeShareDrawable'</a></em>, but it didn't work.</p> </div> <p>转载于:https://stackoverflow.com/questions/32075498/error-retrieving-parent-for-item-no-resource-found-that-matches-the-given-name</p>

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

点沙成金:英特尔芯片制造全过程揭密

“亚马逊丛林里的蝴蝶扇动几下翅膀就可能引起两周后美国德州的一次飓风……” 这句人人皆知的话最初用来描述非线性系统中微小参数的变化所引起的系统极大变化。 而在更长的时间尺度内,我们所生活的这个世界就是这样一个异常复杂的非线性系统…… 水泥、穹顶、透视——关于时间与技艺的蝴蝶效应 公元前3000年,古埃及人将尼罗河中挖出的泥浆与纳特龙盐湖中的矿物盐混合,再掺入煅烧石灰石制成的石灰,由此得来了人...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

你打算用Java 8一辈子都不打算升级到Java 14,真香

我们程序员应该抱着尝鲜、猎奇的心态,否则就容易固步自封,技术停滞不前。

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《经典算法案例》01-08:如何使用质数设计扫雷(Minesweeper)游戏

我们都玩过Windows操作系统中的经典游戏扫雷(Minesweeper),如果把质数当作一颗雷,那么,表格中红色的数字哪些是雷(质数)?您能找出多少个呢?文中用列表的方式罗列了10000以内的自然数、质数(素数),6的倍数等,方便大家观察质数的分布规律及特性,以便对算法求解有指导意义。另外,判断质数是初学算法,理解算法重要性的一个非常好的案例。

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

一文带你入门Java Stream流,太强了

两个星期以前,就有读者强烈要求我写一篇 Java Stream 流的文章,我说市面上不是已经有很多了吗,结果你猜他怎么说:“就想看你写的啊!”你看你看,多么苍白的喜欢啊。那就“勉为其难”写一篇吧,嘻嘻。 单从“Stream”这个单词上来看,它似乎和 java.io 包下的 InputStream 和 OutputStream 有些关系。实际上呢,没毛关系。Java 8 新增的 Stream 是为...

都前后端分离了,咱就别做页面跳转了!统统 JSON 交互

文章目录1. 无状态登录1.1 什么是有状态1.2 什么是无状态1.3 如何实现无状态1.4 各自优缺点2. 登录交互2.1 前后端分离的数据交互2.2 登录成功2.3 登录失败3. 未认证处理方案4. 注销登录 这是本系列的第四篇,有小伙伴找不到之前文章,松哥给大家列一个索引出来: 挖一个大坑,Spring Security 开搞! 松哥手把手带你入门 Spring Security,别再问密...

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

立即提问
相关内容推荐