所以我有以下项目结构:
.
├── Central
│ ├── app
│ │ ├── build.gradle
│ │ └── src
│ ├── build.gradle
│ ├── gradle.properties
│ └── settings.gradle
└── Client
├── app
│ ├── build.gradle
│ └── src
├── build.gradle
├── gradle.properties
└── settings.gradle
在Central应用程序中,我定义了服务以及AIDL接口。在AIDL中,其中一个函数返回一个自定义对象(扩展了Parcelable)。在客户端应用程序中,我放置了完全相同的AIDL文件(在src/aidl
目录中的相同程序包下)。我尝试通过向Central应用程序声明gradle依赖项来导入自定义类。
这是客户端的settings.gralde
rootProject.name='Client'
include ':app'
include ":Central"
project(":Central").projectDir = file('../Central/app')
客户端的app / build.gralde:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.Patel.Cli3n5"
minSdkVersion 28
targetSdkVersion 29
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation project(path: ':Central', configuration: 'default')
}
以及辅助文件(在两个应用程序中均存在:):>
package com.Patel.Central; import android.graphics.Bitmap; parcelable Info; interface MusicCentral { List<Info> getAllSongsInfo(); Bitmap getSongImage(int songNum); }
并且请注意,Info类是在包
com.Patel.Central
中定义的。
[当我尝试构建客户端应用程序时,出现以下错误:
error: cannot find symbol @Override public java.util.List<com.Patel.Central.Info> getAllSongsInfo() throws android.os.RemoteException
总而言之,问题在于有一个自定义类,我需要从另一个目录中的应用程序导入。
因此,我具有以下项目结构:。 ├──中央│├──应用││├──build.gradle││└──src│├──build.gradle│├──gradle.properties│└──settings.gradle└──客户├─ ─...
您需要定义两个文件