У меня есть две банки: left.jar
и right.jar
.Они похожи, но не идентичны.
left.jar:
package com.mydomain.config
public class PkgConfig {
public static int getID() {
throw new RuntimeException();
}
public static String getLeftValue() {
throw new RuntimeException();
}
// the rest of the methods are the same with right.jar
}
right.jar:
package com.mydomain.config
public class PkgConfig {
public static int getID() {
throw new RuntimeException();
}
public static String getRightValue() {
throw new RuntimeException();
}
// the rest of the methods are the same with left.jar
}
В своей деятельности я делаю это:
public void myMethod() {
if(com.mydomain.config.PkgConfig.getID() > 1000) {
mDeviceValue = com.mydomain.config.PkgConfig.getLeftValue();
}
else {
mDeviceValue = com.mydomain.config.PkgConfig.getRightValue();
}
}
И вот как я объявил зависимость:
compileOnly files('libs/left.jar')
compileOnly files('libs/right.jar')
Эта настройка выдает мне сообщение о том, что
error: не удается найти метод символа getRightValue ()
Моя цель - создать из этого один APK.Я знаю, что могу использовать sourcesets и сделать это:
leftCompileOnly files('libs/left.jar')
rightCompileOnly files('libs/right.jar')
, но он создает два APK.Есть ли способ обойти эту проблему?