Android 应用停止使用最新版本的 PhoneGap Build

Android apps stopped working with newest versions of PhoneGap Build

我使用 PhoneGap 将 AngularJS 应用程序转换为 Android 和 iOS。我需要为 iOS 9 升级到最新版本的 PhoneGap,但它破坏了 Android 应用程序。

具体来说,它会阻止 ngResource 工作,因此我无法从我的服务器获取身份验证令牌。

Android 在 config.xml 首选项设置为

时工作正常
<preference name="phonegap-version" value="3.7.0" />

Android 甚至无法使用其中任何一个向服务器发送请求

<preference name="phonegap-version" value="cli-5.1.1" />
<preference name="phonegap-version" value="cli-5.2.0" />

这是我的 AngularJs 登录函数和 ngResource 工厂。

$scope.login = function () {
    AuthenticationService.get({
            'clientId':$rootScope.clientId,
            'clientSecret':$rootScope.clientSecret,
            'username':$scope.loginData.username,
            'password':$scope.loginData.password
        },
        function(data){},
        function(error){
            toastr.error('Authentication failed, please try again.');
        }
    )
    .$promise.then(function(response){
       ...
    });
};


.factory( 'AuthenticationService', function($resource, $rootScope) {
    return $resource(
        $rootScope.url+'/oauth/v2/token?client_id=:clientId&client_secret=:clientSecret&grant_type=password&username=:username&password=:password',
        {
            clientId:'@clientId',
            clientSecret:'@clientSecret',
            username:'@username',
            password:'@password'
        },
        {
            get: { method: 'JSONP', params: { callback: 'JSON_CALLBACK' }, isArray: false }
        }
    );
})

有谁知道 Android 的较新版本的 PhoneGap 中发生了什么变化可能会导致这种情况?

请在您的 config.xml

中添加 whitelist 插件参考
<gap:plugin name="cordova-plugin-whitelist" source="npm" />