1

嗨,我不是专业的 Java 开发人员,但我正在尝试编写一个 android 本机组件以响应本机,但在编写它时我面临以下错误日志。

/Users/waqas.bhatti/Projects/es-tracker/mobile/tracker/custom_modules/custom-react-native-app-auth/android/src/main/java/com/reactlibrary/RNCustomAppAuthModule.java:27: error: AdditionalParamsProcessor is not public in net.openid.appauth; cannot be accessed from outside package
import static net.openid.appauth.AdditionalParamsProcessor.builtInParams;
                                ^
/Users/waqas.bhatti/Projects/es-tracker/mobile/tracker/custom_modules/custom-react-native-app-auth/android/src/main/java/com/reactlibrary/RNCustomAppAuthModule.java:27: error: static import only from classes and interfaces
import static net.openid.appauth.AdditionalParamsProcessor.builtInParams;
^
/Users/waqas.bhatti/Projects/es-tracker/mobile/tracker/custom_modules/custom-react-native-app-auth/android/src/main/java/com/reactlibrary/RNCustomAppAuthModule.java:28: error: AdditionalParamsProcessor is not public in net.openid.appauth; cannot be accessed from outside package
import static net.openid.appauth.AdditionalParamsProcessor.checkAdditionalParams;
                                ^
/Users/waqas.bhatti/Projects/es-tracker/mobile/tracker/custom_modules/custom-react-native-app-auth/android/src/main/java/com/reactlibrary/RNCustomAppAuthModule.java:28: error: static import only from classes and interfaces
import static net.openid.appauth.AdditionalParamsProcessor.checkAdditionalParams;
^
/Users/waqas.bhatti/Projects/es-tracker/mobile/tracker/custom_modules/custom-react-native-app-auth/android/src/main/java/com/reactlibrary/RNCustomAppAuthModule.java:106: error: cannot find symbol
                                .setCodeVerifier(CodeVerifierUtil.generateRandomCodeVerifier())
                                                 ^
  symbol: variable CodeVerifierUtil
5 errors

知道如何导入它吗?或者有什么解决方法吗?

您可以从以下 URL 检查此库: https ://github.com/openid/AppAuth-Android/blob/master/library/java/net/openid/appauth/AuthorizationServiceConfiguration.java#L102

4

1 回答 1

1

调用包保护方法的一个丑陋的解决方法是在该包中放置一个自己的类,并使用一个转发方法调用的公共方法。

例如:

public class net.openid.appauth.PublicWorkarround {
    public static Set<String> buildInParams(Set<String> params) {
        return net.openid.appauth.AdditionalParamsProcessor.builtInParams(params);
    }
} 
于 2018-02-03T10:03:46.563 回答