2017-06-05 124 views
1

當我嘗試在我的Android設備中運行我的react-native應用程序時,出現問題。即使我確定它已連接,設備也會連接。設備的react-native run-android失敗,無法安裝應用程序

ADB設備

名單附

HMNBBCE6A2826109設備

裝置:華爲Y2 的Android版本:5.1 調試模式:enbaled 服務器正在運行。 當我運行

反應本地運行的Android

我得到這個錯誤

無法在設備上安裝應用程序,閱讀上面的內容錯誤。 確保你有一個Android模擬器運行或連接的設備,並且已經設置 您的Android開發環境: https://facebook.github.io/react-native/docs/android-setup.html

回答

0

嘗試該命令。

adb devices 

查看是否列出任何設備。

如果是這樣檢查android文件夾內的local.properties文件,並檢查定義的sdk是否正確。

如果沒有local.properties文件。添加新的文件名爲local.properties,內容如下

## This file is automatically generated by Android Studio. 
# Do not modify this file -- YOUR CHANGES WILL BE ERASED! 
# 
# This file must *NOT* be checked into Version Control Systems, 
# as it contains information specific to your local configuration. 
# 
# Location of the SDK. This is only used by Gradle. 
# For customization when using a Version Control System, please read the 
# header note. 
#Thu May 25 18:29:08 IST 2017 
sdk.dir=path to sdk 

該命令也將有助於

adb reverse tcp:8081 tcp:8081 
4

我有我的Linux筆記本電腦同樣的問題。 我跑這我的應用程序的根文件夾內的工作:

chmod 755 android/gradlew 

你必須給在android/gradlew權限。

我發現this GitHub的問題

的答案,你也必須這樣做:

點擊here看到反應本地文檔頁面上的所有文章(在這裏我得到這個信息的地方) 。

  • 配置ANDROID_HOME環境變量
    的陣營本地工具需要某些環境變量,以建立與本地代碼的應用程序進行設置。
    將以下幾行添加到您的$ HOME /。在.bash_profile配置文件:
    export ANDROID_HOME=$HOME/Android/Sdk
    export PATH=$PATH:$ANDROID_HOME/tools
    export PATH=$PATH:$ANDROID_HOME/platform-tools

    .bash_profile是具體的抨擊。如果您使用的是其他shell,則需要編輯適當的特定於shell的配置文件。

  • 相關問題