Java Android Studio Wear操作系统应用程序可以';无法安装安装\u解析\u失败\u没有\u证书
我是安卓工作室魔法世界的新手。我正在尝试开发一个简单的Wear Os应用程序来扫描近蓝牙设备 MainActivity.javaJava Android Studio Wear操作系统应用程序可以';无法安装安装\u解析\u失败\u没有\u证书,java,android-studio,wear-os,android-bluetooth,bluetooth-gatt,Java,Android Studio,Wear Os,Android Bluetooth,Bluetooth Gatt,我是安卓工作室魔法世界的新手。我正在尝试开发一个简单的Wear Os应用程序来扫描近蓝牙设备 MainActivity.java package com.firstapp.testble; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.content.BroadcastReceiver; import android.content.Cont
package com.firstapp.testble;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.wearable.activity.WearableActivity;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
public class MainActivity extends WearableActivity {
private ListView listView;
private ArrayList<String> mDeviceList = new ArrayList<String>();
private BluetoothAdapter mBluetoothAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listView = (ListView) findViewById(R.id.listView);
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if(mBluetoothAdapter == null){
System.out.println(">>>>>>>>>>>>>>>>>>ERRORRE");
}else{
mBluetoothAdapter.startDiscovery();
IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
registerReceiver(mReceiver, filter);
// Enables Always-on
setAmbientEnabled();
}
}
@Override
protected void onDestroy() {
unregisterReceiver(mReceiver);
super.onDestroy();
}
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
BluetoothDevice device = intent
.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
mDeviceList.add(device.getName() + "\n" + device.getAddress());
Log.i("BT", device.getName() + "\n" + device.getAddress());
listView.setAdapter(new ArrayAdapter<String>(context,
android.R.layout.simple_list_item_1, mDeviceList));
}
}
};
}
对于其他简单的应用程序,我没有这种问题。
这里是我已经尝试过的:
玛拉< P>如果您已经签了APK,您可以考虑安装发布版本,而不是安装您正在尝试安装的调试版本。 从下面的日志中,我可以看到您正在尝试安装调试版本
[0] 'C:\Users\marac\AndroidStudioProjects\TestBLE\app\build\outputs\apk\debug\app-debug.apk'
可以在
\Users\marac\AndroidStudioProjects\TestBLE\app\build\outputs\apk\release
文件夹下找到版本apk。问题是我需要在调试模式下测试我的应用程序。我试图使Build>Generate Singned Bundle/APK的操作正常工作。代码编译正确,问题只出现在我尝试将apk上载到SmartWatch时。有什么我不明白的吗?我明白了。你能核对一下这个答案吗?
Launching 'app' on Physical Device.
Timed out waiting for process (com.firstapp.testble) to appear on fossil-garrett_hr-127.0.0.1:4444.
Installation did not succeed.
The application could not be installed: INSTALL_PARSE_FAILED_NO_CERTIFICATES
List of apks:
[0] 'C:\Users\marac\AndroidStudioProjects\TestBLE\app\build\outputs\apk\debug\app-debug.apk'
APK signature verification failed.
[0] 'C:\Users\marac\AndroidStudioProjects\TestBLE\app\build\outputs\apk\debug\app-debug.apk'