取销Java模块Android Studio 1.0.1时,程序包不存在 [英] Package does not exist when refrencing a java module Android Studio 1.0.1
问题描述
我正在开发一个需要Java库应用程序(我也写过)才能运行的android应用程序.
I am developing an android application that requires a Java library application (which I also wrote) to run.
我遵循了idunnololz指南此处将项目添加为似乎可以添加的Java库.我的Java项目称为Osmosis,其中包含2个搜索包和common包.
I followed idunnololz guide here to add the project as a java library which seemed to add ok. My java project is called Osmosis and contains 2 packages search and common.
然后我尝试引用我的项目,Android Studio非常有帮助地询问我是否希望引用渗透.这似乎解决了错误,将import Search.*添加到了我的android类的顶部.但是,当我运行我的应用程序时,出现错误:软件包不存在.在单击运行之前,它不会显示任何错误.
I then tried to reference my project, with Android Studio very helpfully asking if I wish to reference osmosis. This seemed to resolve the error, with import Search.* being added to the top of my android class. However, when I run my application I get the error: package does not exist. Until I click run it shows no errors.
任何人都可以提供有关如何解决此问题的建议吗?
Can anyone give any advice on how to fix this?
我尝试使缓存无效,清理并重建项目
I have tried invalidating the caches, cleaning and rebuilding the project
我的settings.gradle似乎包含参考:
My settings.gradle seems to include the reference:
include ':app', ':osmosis'
这是我的build.gradle
and here is my build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
app build.gradle
app build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.matt.windowrunner"
minSdkVersion 21
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:6.5.87'
}
错误:
Error:(48, 14) error: package search does not exist
Error:(448, 7) error: cannot find symbol variable Search
Error:(460, 7) error: cannot find symbol variable Search
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Error:Execution failed for task ':app:compileDebugJava'.
> Compilation failed; see the compiler error output for details.
推荐答案
任何人都可以提供有关如何解决此问题的建议吗?
Can anyone give any advice on how to fix this?
您的依赖项
闭包不会引入库.在您的 build.gradle
中的另外两个 compile
行之后,添加 compile project(:osmosis)
.
Your dependencies
closure does not pull in the library. Add compile project(:osmosis)
after your other two compile
lines in your build.gradle
.
这篇关于取销Java模块Android Studio 1.0.1时,程序包不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!