Visual Studio 2017 中的 Visual C++ 中的 Jar 依赖项(包不存在) [英] Jar Dependencies (package does not exist) in Visual C++ in Visual Studio 2017

查看:25
本文介绍了Visual Studio 2017 中的 Visual C++ 中的 Jar 依赖项(包不存在)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我面临一个问题,即我无法在

<小时>

重现步骤

  1. 确保您安装了具有跨平台支持的 Visual Studio 2017 并打开它
  2. 选择文件"->新建"->项目..."->基本应用程序(Android Ant)"->确定

  1. 在项目中添加一个libs文件夹
  2. project.properties 文件中添加 jar.libs.dir=libs
  3. 从 android-sdk 文件夹中复制文件 design-25.3.1-sources.jar(对我来说它位于 ...\android-sdk\extras\android\m2repository\com\android\support\design\25.3.1) 到 libs 项目文件夹.如果引用会更好.我还没有找到方法.
  4. 在生成的Activity中添加import语句import android.support.design.widget.*;.
  5. 点击F6(构建解决方案)

导致所描述的错误.Visual Studio 2015 也有同样的问题 -> Visual Studio 2015 中 Visual C++ 开发中的 Jar 依赖

我正在寻找一种使用外部库的方法.知道我可以改变什么吗?

2017 年 7 月 10 日更新

我最终不得不放弃并将构建系统从 Ant 更改为 Gradle.使用 Gradle 从 Android SDK 添加库相对容易.这也是我评价结束我的问题的原因.

解决方案

我能解决的唯一方法是将构建系统从 ANT 切换到 Gradle.

I'm facing an issue where I'm unable to use an external *.jar file in a "Visual C++" Android project in Visual Studio 2017 Community Edition.

When I try to compile it says the package android.support.design.widget does not exist.

Here is my setup:


Steps to reproduce

  1. Ensure you installed Visual Studio 2017 with Cross Platform Support and open it
  2. Choose "File"->"New"->"Project..."->"Basic Application (Android Ant)"->OK

  1. Add a libs folder to the project
  2. In the project.properties file add jar.libs.dir=libs
  3. Copy the file design-25.3.1-sources.jar from the android-sdk folder (for me it was under ...\android-sdk\extras\android\m2repository\com\android\support\design\25.3.1) to the libs project folder. If referencing would work even better. I haven't found a way yet.
  4. Add the import statement import android.support.design.widget.*; into the generated Activity.
  5. Hit F6 (Build Solution)

Results in the error described. Also Visual Studio 2015 had the same problem -> Jar Dependencies in Visual C++ Development in Visual Studio 2015

I'm looking for a way to use external libraries. Any idea what I could change?

Update July 10th 2017

I finally had to give up and change the build system from Ant to Gradle. With Gradle it is relatively easy to add libraries from the Android SDK. This is also the reason why I rate to close my question.

解决方案

The only way I could solve it was by switching the build system from ANT to Gradle.

这篇关于Visual Studio 2017 中的 Visual C++ 中的 Jar 依赖项(包不存在)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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