Visual Studio 2017中的Visual C ++中的Jar依赖项(程序包不存在) [英] Jar Dependencies (package does not exist) in Visual C++ in Visual Studio 2017
问题描述
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.
当我尝试编译时,它说软件包android.support.design.widget
不存在.
When I try to compile it says the package android.support.design.widget
does not exist.
这是我的设置:
复制步骤
- 确保已安装具有跨平台支持的Visual Studio 2017并打开它
- 选择文件"->新建"->项目..."->基本应用程序(Android Ant)"->确定
- 在项目中添加
libs
文件夹 - 在
project.properties
文件中添加jar.libs.dir=libs
- 将文件
design-25.3.1-sources.jar
从android-sdk文件夹(对我来说位于...\android-sdk\extras\android\m2repository\com\android\support\design\25.3.1
下)复制到libs
项目文件夹.如果引用会更好.我还没有找到办法. - 将导入语句
import android.support.design.widget.*;
添加到生成的活动中. - 点击
F6
(构建解决方案)
- 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)
导致所描述的错误.同样,Visual Studio 2015也有相同的问题-> Visual Studio 2015中Visual C ++开发中的依赖关系
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?
更新2017年7月10日
我最终不得不放弃并将构建系统从Ant
更改为Gradle
.使用Gradle
,从Android SDK中添加库相对容易.这也是我决定结束问题的原因.
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.
推荐答案
我能解决的唯一方法是将构建系统从ANT切换到Gradle.
The only way I could solve it was by switching the build system from ANT to Gradle.
这篇关于Visual Studio 2017中的Visual C ++中的Jar依赖项(程序包不存在)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!