PhoneGap apk无法正常工作,但服务器正常

时间:2019-11-18 10:01:38

标签: phonegap-build phonegap

<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
    <script src="js/main.js"></script>

    <script type="text/javascript">

    $("#submitButton").click(function() {
        var check = true;
        $('.validate-form .input100').each(function(){
            if(validate(this) == false) check=false;
        });
        if(!check) return;
        $.get(
            "My URL", 
            { email : $("#email").val(), password : $("#pass").val() },
            function(data,stat) {
                    alert("Login "+(data["success"]=="0" ? "Failed" : "Success"));
            }
        );
    });

    </script>

上面的代码在浏览器和PhoneGap Developer Test App中都可以正常工作。但是,每当我尝试构建apk时,都会安装它并加载页面。但是登录脚本似乎没有运行。任何帮助将不胜感激!


以下是我对AndroidManifest.xml的代码:

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0.0" package="com.newsapp.d24" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

以下是我的config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.newsapp.d24" 
    version="1.0.0" 
    xmlns="http://www.w3.org/ns/widgets" 
    xmlns:gap="http://phonegap.com/ns/1.0">
    <name>D24</name>
    <description>
        D24 News App
    </description>
    <author email="support@phonegap.com" href="http://phonegap.com">
        D24 News
    </author>


    <content src="index.html" />
    <access origin="*" />
        <plugin name="cordova-plugin-whitelist" version="1" />
        <allow-navigation href="*" />
        <allow-intent href="http://*/*" />
        <allow-intent href="https://*/*" />

    <plugin name="cordova-plugin-splashscreen" source="npm" />

    <splash src="www/images/splash.jpg" />


    <splash platform="android" qualifier="port-ldpi" src="www/images/splash.jpg" />
    <splash platform="android" qualifier="port-mdpi" src="www/images/splash.jpg" />
    <splash platform="android" qualifier="port-hdpi" src="www/images/splash.jpg" />
    <splash platform="android" qualifier="port-xhdpi" src="www/images/splash.jpg" />

    <splash platform="android" qualifier="land-ldpi" src="www/images/splash.jpg" />
    <splash platform="android" qualifier="land-mdpi" src="www/images/splash.jpg" />
    <splash platform="android" qualifier="land-hdpi" src="www/images/splash.jpg" />
    <splash platform="android" qualifier="land-xhdpi" src="www/images/splash.jpg" />


    <preference name="SplashScreenDelay" value="5000" />

</widget>

添加了初始屏幕

0 个答案:

没有答案