钛合金与 Windows 10 上的 Android 模拟器 [英] Titanium Alloy with Android Emulator on Windows 10

查看:31
本文介绍了钛合金与 Windows 10 上的 Android 模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows 10 上使用 Titanium Alloy 时遇到了大问题.我正在使用 Atom 编辑器来编写我的应用程序.每当我执行 ti build 时,最多输入 10(!!!) 次命令,直到找到 Android 设备.对于 Android 模拟器,我收到如下错误消息:

 [错误] 无法在emulator-5554"上安装 apk[错误] 错误:找不到设备

我尝试了命令 ti build -p androidti build -p android -T emulatorti build -p android -T emulator -C emulator-5554 --log-level 信息.我还尝试从 avd.exe 手动启动模拟器.我删除了 AVD 并创建了一个新的

当连接设备(USB 调试启用)时,我尝试了 ti build -p android -T deviceti build -p android -T device-C XT1032,其中XT1032 是设备的名称.我收到如下错误消息:

 [ERROR] 无法找到任何设备

到目前为止我还没有尝试过,如果再试几次就能找到该设备.
执行命令时,我尝试了所有 4 种组合:

  • 模拟器关闭,设备断开连接
  • 模拟器关闭,设备已连接
  • 模拟器开启,设备断开
  • 模拟器已开启,设备已连接

我卸载了TitaniumAndroid SDKNodeJSJava 并删除了它们的所有文件夹.我也删除了所有注册表项.然后我重新安装了所有东西,最后Titanium.同样的问题.
我正在使用 Java 32 位 (v8.0.1020.14),NodeJS v4.2.6(也尝试过 v6.3.0,但推荐 v4.2.x)、Android SDK(SDK Tools v25.1.7SDK Platform-tools 24.0.1SDK Build-tools 21.1.2.我也试过SDK Build-tools 24.0.1,但推荐21.xx)和Titanium(SDK v6.0.0.v20160719180254CLIv5.0.9).

我修改了我的环境变量如下:
路径:
C:\android-sdk\tools;C:\android-sdk\platform-tools;C:\android-sdk\ndk-bundle;C:\Program Files (x86)\Java\jdk\bin
JAVA_HOME:
C:\Program Files (x86)\Java\jdk
ANDROID_SDK_HOME:
C:\android-sdk我必须设置ANDROID_SDK_HOMEC:\android-sdk\ndk-bundle,否则ti setup check 将找不到NDK 和AVD.

这是ti setup check的截图:图片链接我不知道为什么 https://www.google.com 无法访问.此外,Intel HAXM 已安装.我什至重新安装它没有成功.之前安装的Titanium都能找到...

感谢您的帮助!

TLDNR:我的钛合金安装在查找设备时遇到问题.它只是偶尔工作,没有任何明显的模式

解决方案

构建 APK 文件后进程终止.如果模拟器正在运行,则可以手动安装 APK.在 Command Line 中使用此命令:

 \platform-tools\adb.exe -s emulator-5554 install -r -d <项目路径>\<项目文件夹>\build\android\bin\<项目名称>.apk

项目名称等于项目文件夹名称.安装APK后,可以在模拟器中手动启动应用程序.

尽管如此,在 Windows 10 上开发时仍然存在很多问题......我认为这迫使我切换到 MAC.

I'm having huge problems with Titanium Alloy on Windows 10. I am using the Atom editor to write my apps. Whenever I execute ti build, enter the command up to 10(!!!) times until an Android device can be found. For the Android emulator I get an error message as follows:

    [Error] Failed to install apk on "emulator-5554"
    [Error] Error: device not found

I tried the commands ti build -p android, ti build -p android -T emulator and ti build -p android -T emulator -C emulator-5554 --log-level info. I also tried starting the emulator manually from avd.exe. I deleted the AVD and created a new one, too

When a device (USB debugging enabled) is connected, i tried ti build -p android -T device and ti build -p android -T device -C XT1032, where XT1032 is the name of the device. I get an error message as follows:

    [ERROR] Unable to find any devices

I didn't try so far if the device will be found after some more tries.
When executing the commands, I tried all 4 combinations:

  • emulator off, device disconnected
  • emulator off, device connected
  • emulator on, device disconnected
  • emulator on, device connected

I uninstalled Titanium, Android SDK, NodeJS and Java and deleted all folders of them. I removed all registry entries, too. Then I installed everything again, Titanium at last. Same problem.
I am using Java 32 bit (v8.0.1020.14), NodeJS v4.2.6 (also tried v6.3.0, but v4.2.x is recommend), Android SDK (SDK Tools v25.1.7, SDK Platform-tools 24.0.1 and SDK Build-tools 21.1.2. I also tried SDK Build-tools 24.0.1, but 21.x.x is recommend) and Titanium (SDK v6.0.0.v20160719180254, CLIv5.0.9).

I modified my environment variables as follows:
PATH:
C:\android-sdk\tools;C:\android-sdk\platform-tools;C:\android-sdk\ndk-bundle;C:\Program Files (x86)\Java\jdk<version>\bin
JAVA_HOME:
C:\Program Files (x86)\Java\jdk<version>
ANDROID_SDK_HOME:
C:\android-sdk I had to set ANDROID_SDK_HOME and C:\android-sdk\ndk-bundle, otherwise the NDK and the AVDs wouldn't be found by ti setup check.

Here is a screenshot of ti setup check: link to image I don't know why https://www.google.com is unreachable. Furthermore, Intel HAXM is installed. I even reinstalled it without success. The previous installation of Titanium could find it...

Thanks for your help!

TLDNR: my Titanium Alloy installation has problems finding devices. It only works from time to time without any obvious pattern

解决方案

The process terminates after building the APK file. If the emulator is running, it is possible to manually install the APK. Use this command in the Command Line:

    <Android SDK folder>\platform-tools\adb.exe -s emulator-5554 install -r -d <project path>\<project folder>\build\android\bin\<project name>.apk

The project name is equal to the project folder name. After installing the APK, the application can be started manually in the emulator.

Nonetheless, there are still a lot of issues when developping on Windows 10... I think this forces me to switch to a MAC.

这篇关于钛合金与 Windows 10 上的 Android 模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆