如何从android-studio包外部的目录访问.java文件? [英] How to access .java files from a directory outside of a package in android-studio?

查看:317
本文介绍了如何从android-studio包外部的目录访问.java文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试解决这个问题已经有几个小时了,但在互联网上却找不到解决方案。
我的项目如下:

I try to solve this problem for hours now and didn't find a solution on the internet. my project looks like this:


我想访问 de.MayerhoferSimon.Vertretungsplan 包中标记目录中的文件。 (是的,我知道包应该是小写的。)

I want to access the files in the marked directory in the de.MayerhoferSimon.Vertretungsplan package. (yes, I know packages should be lowercase.)

有可能吗?是的话,怎么办?

Is this possible and when yes, how?

我尝试使用:app 模块的.gradle文件中的依赖项进行某些操作,但无济于事。

I tried some things with the dependencies in the .gradle file of the :app module but nothing worked.

推荐答案

在这种情况下,您应该为您的webuntisaccessor代码创建一个库模块,而不是将其放在libs文件夹中。

In this case you should create a library module for your webuntisaccessor code instead of putting this in the libs folder.

root
  settings.gradle
  app
    build.gradle
  webuntisaccessor
    src
      main    
        java
    build.gradle

settings.gradle 中:

include ':webuntisaccessor' , ':app'

webuntisaccessor / build.gradle

apply plugin: 'com.android.library'

app / build.gradle 添加:

dependencies {
    compile project(':webuntisaccessor')
}

这篇关于如何从android-studio包外部的目录访问.java文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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