The import org.apache.cordova cannot be resolved

2020-02-03 04:29发布

For some reason, after going through Phonegap's non-inclusive instructions (it doesn't even mention setting up ANT, or the headaches with Ant and JDK), this doesn't work at all:

package com.HealthTrustSoftware.AndroidTemplate3;

import android.app.Activity;
import android.os.Bundle;
import org.apache.cordova.*;

public class AndroidTemplate3 extends DroidGap
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        super.loadUrl("file:///android_asset/www/index.html");
    }
}

It gives 5 errors referencing the fact that org.apache.cordova can't be resolved. I'm entirely sure what to do at this point. Please help. This is after 3 hours of trying to get the sdk working and finally being able to open a project within eclipse. After following the steps on their documentation, I am left with a wasted 3 hours unless I can figure this out.

7条回答
趁早两清
2楼-- · 2020-02-03 05:12

Replace your header with some miner changes like bellow

 import com.google.android.gcm.GCMRegistrar;
import org.apache.cordova.api.CallbackContext;
import org.apache.cordova.api.CordovaInterface;
import org.apache.cordova.api.CordovaPlugin;
查看更多
登录 后发表回答