新鲜进口的Android Studio项目与错误模块zxing [英] Freshly imported Android Studio project errors with zxing module
问题描述
我一直使用zxing模块作为没有问题了一段时间的机器人库。我有我的进口Eclipse项目的Android进入工作室(这是我使用的一切!),并斑马线库添加一个模块。
在我的主组件中的一个类我引用com.google.zxing.android.client.Intents类,这是斑马线模块中。我可以写code在Android的工作室,这些提法已经选择了正确的进口。
当我运行一个gradlew干净的构建我得到消息说无法找到符号类意图。
在settings.gradle我已经包括了我的两个主模块和斑马线模块。
在我的主要模块的build.gradle我有'编制项目(':zxing')。从Eclipse中在导入过程中,这些均被加入。我还可以看到,斑马线模块正在修建的gradlew干净构建的一部分。
我曾尝试删除斑马线模块和参考文献,然后试图手动添加。我比较该模块实现与该作品的类似模块,另一个项目的方式。一切看起来很好。
有没有人能提个建议吗?
编辑:
settings.gradle文件
包括':应用程序
包括:captureActivity
主模块的build.gradle
应用插件:'com.android.application安卓{
compileSdkVersion 19
buildToolsVersion20.0.0defaultConfig {
的applicationIDcom.wigglyamps.littlegreenbutton
10的minSdkVersion
targetSdkVersion 19
版本code 1
的versionName1.0
}
buildTypes {
发布 {
runProguard假
proguardFiles getDefaultProguardFile('proguard的-android.txt'),'proguard-rules.pro
}
}
}依赖{
编制项目(':captureActivity')
编译文件树(导演:'库',包括:['的* .jar'])
编译com.android.support:appcompat-v7:19.+
}
主模块中的Java类文件
公共类的测试{ 公共无效打招呼(){
串I = Intents.Scan.ACTION;
}
}
我真的不知道斑马线框架,但是你有没有尝试使用Maven神器而不是引用模块?
如果您想使用此神器添加到项目/模块使用zxing的依赖关系:编译com.google.zxing:核心:3.1.0。
编辑:你说你从Eclipse中导入的项目;我在过渡到摇篮的中间和导入功能几乎不产生,如果Eclipse项目包含到库项目引用任何有用的东西(而不是JAR的)。我通过创建的Android Studio和复制/粘贴code和资源的新的应用程序(带模块)进入新的应用程序的目录从头重建我的项目
I have been using zxing module as an android library for some time without problems. I have imported my Eclipse project into Android Studio (which I use for everything else!) and the zxing library is added as a module.
In one of my classes in the main module I reference the com.google.zxing.android.client.Intents class which is in the zxing module. I can write code in Android studio and these references have the correct imports selected.
When I run a gradlew clean build I am getting messages saying 'cannot find symbol class Intents'.
In settings.gradle I have includes for both my main module and the zxing module.
In the build.gradle of my main module I have 'compile project(':zxing'). These were both added during the import from Eclipse. I can also see that the zxing module is being built as part of the gradlew clean build.
I have tried deleting the zxing module and references then trying to add it manually. I have compared the way that this module is implemented to another project with a similar module that works. All looks fine.
Is anyone able to make a suggestion?
Edit:
settings.gradle file
include ':app'
include ':captureActivity'
build.gradle of main module
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.wigglyamps.littlegreenbutton"
minSdkVersion 10
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile project(':captureActivity')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
}
Java class file in main module
public class test {
public void hello () {
String i = Intents.Scan.ACTION;
}
}
I don't really know the zxing framework, but have you tried to use the maven artifact instead of referencing a module?
If you want to use the artifact add this to the dependencies of the project/module that uses zxing: compile 'com.google.zxing:core:3.1.0'
Edit: You said you imported the project from eclipse; I'm in the middle of transitioning to gradle and the import function hardly produces anything useful if the eclipse project contained references to library projects (not jar's). I rebuild my projects from scratch by creating a new app(with modules) in Android Studio and copy/paste code and resources into the new app's directories
这篇关于新鲜进口的Android Studio项目与错误模块zxing的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!