如何从android-studio包外部的目录访问.java文件?

如何从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')
}