小编Kev*_*tel的帖子

运行仪器测试离子Gitlab CI时出现不兼容的AVD错误

每当我尝试为我的android项目运行检测测试时,我都会收到以下错误:

Skipping device 'test(AVD)' for 'app:': Unknown API Level

 > : No compatible devices connected.[TestRunner] FAILED 
Found 1 connected device(s), 0 of which were compatible.
:app:connectedDebugAndroidTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:connectedDebugAndroidTest'.
> There were failing tests. See the report at: file:///builds/antitheft/anti-theft-screen-lock/app/build/reports/androidTests/connected/index.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2 mins …
Run Code Online (Sandbox Code Playgroud)

testing instrumentation android gitlab gitlab-ci

7
推荐指数
1
解决办法
543
查看次数

启动活动时,将USB拇指驱动器安装到Android设备上

我正在尝试将USB大容量存储设备安装到运行android的Raspberry Pi上.我遇到了这个答案,它展示了如何使用命令行ADB shell安装它.但问题是每次我的设备启动时都必须运行这些命令.我想在onCreate()我的发布活动中安装USB驱动器.这是代码:

//Here is the mount drive function which I called in onCreate of my activity.

 private void mountDrive() throws IOException, InterruptedException {
        Process mProcess = Runtime.getRuntime().exec("/system/xbin/su");
        BufferedReader reader = new BufferedReader(new InputStreamReader(mProcess.getInputStream()));

        DataOutputStream dos = new DataOutputStream(mProcess.getOutputStream());
        dos.writeBytes("mkdir /mnt/usb\n");
        dos.flush();
        dos.writeBytes("mount -t vfat -o rw /dev/block/sda1 /mnt/usb\n");
        dos.flush();
        dos.writeBytes("exit\n");

        //Read the response
        String line, result = "";
        while ((line = reader.readLine()) != null) {
            result += line;
            Log.d("CMD","RESULT:"+result);
        }
        reader.close();
        dos.flush();
        dos.close();

        mProcess.waitFor();
    } …
Run Code Online (Sandbox Code Playgroud)

android usb-drive raspberry-pi3 android-things

5
推荐指数
1
解决办法
929
查看次数