科尔多瓦+ Visual Studio + Android@7.0.0? [英] Cordova + Visual Studio + Android@7.0.0?

查看:87
本文介绍了科尔多瓦+ Visual Studio + Android@7.0.0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能获得最新的android更新(7.0.0)来与Visual Studio一起工作吗?

Has anyone been able to get the lastest android update (7.0.0) to work with visual studio?

VS说构建成功,但是当您尝试部署时,该步骤失败了,因为它找不到所创建的输出.

VS says the build is successful, but when you try to deploy, the step fails because it cannot find the created output.

认为可能是更新一些路径的问题,但是我想知道是否有人已经弄清楚了.

I THINK it may be a matter of updating some of the paths, but figured I'd see if anyone has already figured it out.

鉴于taco.visualstudio.com自2017年6月以来没有更新,我想知道该项目是否还没有结束:-(

Given that taco.visualstudio.com hasn't seen an update since June 2017, I'm wondering if the project isn't dead :-(

1>------ Build started: Project: myProject, Configuration: Debug Android ------
Cordova 7.1.0
------ Platform android already exists
------ Copying native files from D:\myproject\res\native\android to D:\myproject\platforms\android
------ Done copying native files to D:\myproject\platforms\android
2>------ Deploy started: Project: myProject, Configuration: Debug Android ------
2>Could not locate the start page. You may need to build your project.
2>Deployment failed.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========

回到Android@6.4.0已经解决了我的直接问题.但这不是一个长期的解决方案.

Backing down to Android@6.4.0 has resolved my immediate problem. But it is not a long term solution.

推荐答案

有点黑,但这就是我要工作的地方.

A bit hacky, but here's what I got to work.

从以下地方得到了一个提示: https://developercommunity.visualstudio.com/content/problem/199609/cordova-ios-640-deployment-error-due-to-change-bui.html (尽管建议的路径对我不起作用)

Got a clue from: https://developercommunity.visualstudio.com/content/problem/199609/cordova-ios-640-deployment-error-due-to-change-bui.html (although suggested path did not work for me)

到目前为止,我只是在研究Android,因此我将在这方面进行讨论.科尔多瓦android平台6.4+将内置的apk放在这里:

I've only been looking at Android so far, so I will talk in terms of that. The cordova android platform 6.4+ puts the built apk here:

[项目] \平台\ android \ app \ build \ outputs \ apk \ debug \ app-debug.apk

Visual Studio似乎在这里寻找它:

Visual Studio seems to be looking for it here:

[项目] \平台\ android \ build \ outputs \ apk \ app-debug.apk

我添加了一个"after_build"钩子,该钩子将app-debug.apk和output.json文件复制到VS正在查找的文件夹中.我必须手动添加文件夹结构(用于复制文件的位置和位置钩文件).我刚刚添加了以下文件,并且构建过程会自动将其选中.

I added an "after_build" hook that copies the app-debug.apk and output.json files to the folder VS is looking in. I had to manually add the folder structures (for both the location of files being copied and location of hook file). I just added the following file, and the build process picks it up automatically.

[项目] \ hooks \ after_build \ copy_android_apk.js

copy_android_apk.js的内容:

contents of copy_android_apk.js:

#!/usr/bin/env node

console.log(" -- manual step -- have to copy apk to this folder because that is where VS is looking for it...");

var fs = require('fs');
var path = require('path');
var rootdir = process.argv[2];

var srcfile = path.join(rootdir, "platforms\\android\\app\\build\\outputs\\apk\\debug\\app-debug.apk");
var destfile = path.join(rootdir, "platforms\\android\\build\\outputs\\apk\\app-debug.apk");

var destdir = path.dirname(destfile);
if(fs.existsSync(srcfile) && fs.existsSync(destdir)) {
    fs.createReadStream(srcfile).pipe(
        fs.createWriteStream(destfile));
}

srcfile = path.join(rootdir, "platforms\\android\\app\\build\\outputs\\apk\\debug\\output.json");
destfile = path.join(rootdir, "platforms\\android\\build\\outputs\\apk\\output.json");

destdir = path.dirname(destfile);
if(fs.existsSync(srcfile) && fs.existsSync(destdir)) {
    fs.createReadStream(srcfile).pipe(
        fs.createWriteStream(destfile));
}

这篇关于科尔多瓦+ Visual Studio + Android@7.0.0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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