2016-12-23 42 views
1

我嘗試使用Android Things項目控制Android應用上的GPIO端口。 但是當我運行通過亞行這個程序(在Android工作室),發出下面的消息..如何解決Android項目上的INSTALL_FAILED_MISSING_SHARED_LIBRARY項目

安裝有消息 INSTALL_FAILED_MISSING_SHARED_LIBRARY失敗。有可能這個問題 通過卸載現有版本的apk來解決,如果它現在是 ,然後重新安裝。

警告:卸載將刪除應用程序數據!

是否要卸載現有的應用程序?

我該如何解決這個問題?

Android版本的是Android 5.1.1(API 22) 我的Android應用程序是根據網站這也解釋了事情的Android項目(https://developer.android.com/things/sdk/pio/gpio.html#managing_the_connection

的應用程序的的build.gradle是下面的編碼。

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "24.0.3" 

    defaultConfig { 
     applicationId "kr.iges.wallpad.gpiotest" 
     minSdkVersion 15 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:25.1.0' 
    provided 'com.google.android.things:androidthings:0.1-devpreview' 
} 

而且AndroidManifest.xml中是

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="kr.iges.wallpad.gpiotest"> 

    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:supportsRtl="true" 
     android:theme="@style/AppTheme"> 
     <uses-library android:name="com.google.android.things"/> 
     <activity android:name=".MainActivity"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

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

      <intent-filter> 
       <action android:name="android.intent.action.MAIN"/> 
       <category android:name="android.intent.category.IOT_LAUNCHER"/> 
       <category android:name="android.intent.category.DEFAULT"/> 
      </intent-filter> 
     </activity> 
    </application> 

</manifest> 

和Java代碼是

package kr.iges.wallpad.gpiotest; 

import android.os.Bundle; 
import android.support.v7.app.AppCompatActivity; 
import android.util.Log; 

import com.google.android.things.pio.PeripheralManagerService; 

import java.util.List; 

public class MainActivity extends AppCompatActivity { 
    private static final String TAG = "GpioTest"; 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 

     PeripheralManagerService manager = new PeripheralManagerService(); 

     List<String> portList = manager.getGpioList(); 

     if (portList.isEmpty()) { 
      Log.i(TAG, "No GPIO port available on this device."); 
     } else { 
      Log.i(TAG, "List of available ports: " + portList); 
     } 

     setContentView(R.layout.activity_main); 
    } 
} 

你知道這個問題的解決方案?

感謝您的閱讀。

回答

0

將東西共享庫條目添加到您應用的清單文件中: 這對我有效。確保只在應用程序標籤內添加使用庫。 ...

相關問題