Visual Studio 2017 中的 Visual C++ 中的 Jar 依赖项(包不存在) [英] Jar Dependencies (package does not exist) in Visual C++ in Visual Studio 2017
问题描述
我面临一个问题,即我无法在
<小时>重现步骤
- 确保您安装了具有跨平台支持的 Visual Studio 2017 并打开它
- 选择文件"->新建"->项目..."->基本应用程序(Android Ant)"->确定
- 在项目中添加一个
libs
文件夹 - 在
project.properties
文件中添加jar.libs.dir=libs
- 从 android-sdk 文件夹中复制文件
design-25.3.1-sources.jar
(对我来说它位于...\android-sdk\extras\android\m2repository\com\android\support\design\25.3.1
) 到libs
项目文件夹.如果引用会更好.我还没有找到方法. - 在生成的Activity中添加import语句
import android.support.design.widget.*;
. - 点击
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
- Ensure you installed Visual Studio 2017 with Cross Platform Support and open it
- Choose "File"->"New"->"Project..."->"Basic Application (Android Ant)"->OK
- Add a
libs
folder to the project - In the
project.properties
file addjar.libs.dir=libs
- 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 thelibs
project folder. If referencing would work even better. I haven't found a way yet. - Add the import statement
import android.support.design.widget.*;
into the generated Activity. - 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屋!