Error[8]: Undefined offset: 5, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

概述我将在我的 Android应用程序中访问linkedin配置文件.我使用下面的代码,它在Android设备上工作正常,但在模拟器上崩溃.不知道问题出在哪里.我的代码如下. Config.java public class Config { public static String LINKEDIN_CONSUMER_KEY = "75rbbjsc94argh"; public s 我将在我的 Android应用程序中访问linkedin配置文件.我使用下面的代码,它在AndroID设备上工作正常,但在模拟器上崩溃.不知道问题出在哪里.我的代码如下.

Config.java

public class Config {    public static String linkEDIN_CONSUMER_KEY = "75rbbJsc94argh";    public static String linkEDIN_CONSUMER_SECRET = "G85WTKgcIijk4U6Yu";    public static String scopeParams = "rw_nus+r_basicprofile+r_fullprofile+r_emailaddress+r_network+r_contactinfo+rw_groups+rw_company_admin";    public static String OAUTH_CALLBACK_SCHEME = "x-oauthflow-linkedin";    public static String OAUTH_CALLBACK_HOST = "callback";    //public static String OAUTH_CALLBACK_URL = OAUTH_CALLBACK_SCHEME + "://" + OAUTH_CALLBACK_HOST;    public static String OAUTH_CALLBACK_URL = "x-oauthflow-linkedin://callback";}

linkedInSampleActivity.java

public class linkedInSampleActivity extends Activity {    button login;    button share;    EditText et;    TextVIEw name;    ImageVIEw photo;    public static final String OAUTH_CALLBACK_HOST = "litestcalback";    final linkedInOAuthService oAuthService = linkedInOAuthServiceFactory            .getInstance().createlinkedInOAuthService(                    Config.linkEDIN_CONSUMER_KEY,Config.linkEDIN_CONSUMER_SECRET,Config.scopeParams);    final linkedInapiclientFactory factory = linkedInapiclientFactory            .newInstance(Config.linkEDIN_CONSUMER_KEY,Config.linkEDIN_CONSUMER_SECRET);    linkedInRequestToken liToken;    linkedInapiclient clIEnt;    linkedInAccesstoken accesstoken = null;    @OverrIDe    public voID onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentVIEw(R.layout.main);        share = (button) findVIEwByID(R.ID.share);        name = (TextVIEw) findVIEwByID(R.ID.name);        et = (EditText) findVIEwByID(R.ID.et_share);        login = (button) findVIEwByID(R.ID.login);        photo = (ImageVIEw) findVIEwByID(R.ID.photo);        login.setonClickListener(new OnClickListener() {            @OverrIDe            public voID onClick(VIEw v) {                linkedInLogin();            }        });    }    private voID linkedInLogin() {        ProgressDialog progressDialog = new ProgressDialog(                linkedInSampleActivity.this);        linkedindialog d = new linkedindialog(linkedInSampleActivity.this,progressDialog);        d.show();        // set call back Listener to get oauth_verifIEr value        d.setVerifIErListener(new OnVerifyListener() {            @OverrIDe            public voID onVerify(String verifIEr) {                try {                    Log.i("linkedinSample","verifIEr: " + verifIEr);                    accesstoken = linkedindialog.oAuthService                            .getoAuthAccesstoken(linkedindialog.liToken,verifIEr);                    linkedindialog.factory.createlinkedInapiclient(accesstoken);                    clIEnt = factory.createlinkedInapiclient(accesstoken);                    clIEnt.postNetworkUpdate("Testing by Umesh!!! linkedIn wall post from AndroID app");                    Person p2 = clIEnt.getProfileForCurrentUser(EnumSet.of(ProfileFIEld.ID));                     Person p = clIEnt.getProfileByID(p2.getID(),EnumSet.of(                    ProfileFIEld.FirsT_name,ProfileFIEld.LAST_name,ProfileFIEld.SKILLS,ProfileFIEld.headliNE,ProfileFIEld.SUMMARY,ProfileFIEld.LANGUAGES,ProfileFIEld.LANGUAGES_LANGUAGE_name,ProfileFIEld.LANGUAGES_PROFICIENCY_name,ProfileFIEld.LANGUAGES_LANGUAGE,ProfileFIEld.HOnorS,ProfileFIEld.INTERESTS,ProfileFIEld.positionS,ProfileFIEld.EDUCATIONS,ProfileFIEld.INDUSTRY,ProfileFIEld.API_STANDARD_PROfile_REQUEST,ProfileFIEld.PICTURE_URL,ProfileFIEld.PUBliC_PROfile_URL));                    name.setText("Welcome " + p.getFirstname() + " "+ p.getLastname());                    Log.i("linkedinSample","ln_access_token: " + accesstoken.getToken());                    Log.i("linkedinSample","ln_access_token: " + accesstoken.getTokenSecret());                    Log.i("Firstname"," : " + p.getFirstname());                    Log.i("Lastname"," : " + p.getLastname());                    Log.i("User Summary"," : " + p.getSummary());                    Log.i("headline"," : " + p.getheadline());                    Log.i("Interest"," : "+p.getInterests());                    //----------------------------------------------------                    for (position position:p.getpositions().getpositionList())                    {                        Log.i("position "," : " + position.getTitle());                        Log.i("comp "," : " + position.getCompany().getname());                    }                    for (Education education:p.getEducations().getEducationList())                     {                        Log.i("Degree "," : "+ education.getDegree());                        Log.i("School name "," : "+ education.getSchoolname());                    }                    Log.i("Language "," : ");                    for(Language language:p.getLanguages().getLanguageList())                    {                        Log.i(""," : "+language.getLanguage().getname());                    }                    Log.i("Skill "," : ");                    for(Skill skill:p.getSkills().getSkillList())                    {                        Log.i(""," : "+skill.getSkill().getname());                    }                    Log.i("Honor"," : "+p.getHonors());                    //----------------------------------------------------                    name.setVisibility(0);                    login.setVisibility(4);                    share.setVisibility(0);                    et.setVisibility(0);                } catch (Exception e) {                    Log.i("linkedinSample","error to get verifIEr");                    e.printstacktrace();                }            }        });        // set progress dialog        progressDialog.setMessage("Loading...");        progressDialog.setCancelable(true);        progressDialog.show();    }}

linkedindialog.java

public class linkedindialog extends Dialog {    private ProgressDialog progressDialog = null;    public static linkedInapiclientFactory factory;    public static linkedInOAuthService oAuthService;    public static linkedInRequestToken liToken;    //Construct a new linkedIn dialog    public linkedindialog(Context context,ProgressDialog progressDialog) {        super(context);        this.progressDialog = progressDialog;    }    @OverrIDe    protected voID onCreate(Bundle savedInstanceState) {        requestwindowFeature(Window.FEATURE_NO_Title);// must call before super.        super.onCreate(savedInstanceState);        setContentVIEw(R.layout.ln_dialog);        setWebVIEw();    }    // set webvIEw.    private voID setWebVIEw() {        linkedindialog.oAuthService = linkedInOAuthServiceFactory.getInstance()                .createlinkedInOAuthService(Config.linkEDIN_CONSUMER_KEY,Config.linkEDIN_CONSUMER_SECRET);        linkedindialog.factory = linkedInapiclientFactory.newInstance(                Config.linkEDIN_CONSUMER_KEY,Config.linkEDIN_CONSUMER_SECRET);        linkedindialog.liToken = linkedindialog.oAuthService.getoAuthRequestToken(Config.OAUTH_CALLBACK_URL);        WebVIEw mWebVIEw = (WebVIEw) findVIEwByID(R.ID.webkitWebVIEw1);        mWebVIEw.getSettings().setJavaScriptEnabled(true);        Log.i("linkedinSample",linkedindialog.liToken.getAuthorizationUrl());        mWebVIEw.loadUrl(linkedindialog.liToken.getAuthorizationUrl());        mWebVIEw.setWebVIEwClIEnt(new HelloWebVIEwClIEnt());        mWebVIEw.setPictureListener(new PictureListener() {            @OverrIDe            public voID onNewPicture(WebVIEw vIEw,Picture picture) {                if (progressDialog != null && progressDialog.isShowing()) {                    progressDialog.dismiss();                }            }        });    }    //webvIEw clIEnt for internal url loading    class HelloWebVIEwClIEnt extends WebVIEwClIEnt {        @OverrIDe        public boolean shouldOverrIDeUrlLoading(WebVIEw vIEw,String url) {            if (url.contains(Config.OAUTH_CALLBACK_URL)) {                Uri uri = Uri.parse(url);                String verifIEr = uri.getqueryParameter("oauth_verifIEr");                cancel();                for (OnVerifyListener d : Listeners) {                    // call Listener method                    d.onVerify(verifIEr);                }            } else if (url.contains("https://www.linkedin.com/uas/oauth/redorangetechnologIEs.com")) {                cancel();            } else {                Log.i("linkedinSample","url: " + url);                vIEw.loadUrl(url);            }            return true;        }    }    /**     * List of Listener.     */    private List<OnVerifyListener> Listeners = new ArrayList<OnVerifyListener>();    /**     * Register a callback to be invoked when authentication have finished.     *      * @param data     *            The callback that will run     */    public voID setVerifIErListener(OnVerifyListener data) {        Listeners.add(data);    }    /**     * Listener for oauth_verifIEr.     */    interface OnVerifyListener {        /**         * invoked when authentication have finished.         *          * @param verifIEr         *            oauth_verifIEr code.         */        public voID onVerify(String verifIEr);    }}

应用程序崩溃,单击登录按钮,错误显示在setWebVIEw();在linkedindialog类中.

以下是logcat:

01-17 15:50:06.513: E/AndroIDRuntime(2544): FATAL EXCEPTION: main01-17 15:50:06.513: E/AndroIDRuntime(2544): com.Google.code.linkedinAPI.clIEnt.oauth.linkedInOAuthServiceException: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provIDer Failed: null01-17 15:50:06.513: E/AndroIDRuntime(2544):     at com.Google.code.linkedinAPI.clIEnt.oauth.linkedInOAuthServiceImpl.getoAuthRequestToken(linkedInOAuthServiceImpl.java:205)01-17 15:50:06.513: E/AndroIDRuntime(2544):     at com.mukesh.linkedin.linkedindialog.setWebVIEw(linkedindialog.java:65)01-17 15:50:06.513: E/AndroIDRuntime(2544):     at com.mukesh.linkedin.linkedindialog.onCreate(linkedindialog.java:54)01-17 15:50:06.513: E/AndroIDRuntime(2544):     at androID.app.Dialog.dispatchOnCreate(Dialog.java:340)01-17 15:50:06.513: E/AndroIDRuntime(2544):     at androID.app.Dialog.show(Dialog.java:253)01-17 15:50:06.513: E/AndroIDRuntime(2544):     at com.mukesh.linkedin.linkedInSampleActivity.linkedInLogin(linkedInSampleActivity.java:100)01-17 15:50:06.513: E/AndroIDRuntime(2544):     at com.mukesh.linkedin.linkedInSampleActivity.access
if (androID.os.Build.VERSION.SDK_INT > 9) {        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy);        }
(linkedInSampleActivity.java:94)01-17 15:50:06.513: E/AndroIDRuntime(2544): at com.mukesh.linkedin.linkedInSampleActivity.onClick(linkedInSampleActivity.java:69)01-17 15:50:06.513: E/AndroIDRuntime(2544): at androID.vIEw.VIEw.performClick(VIEw.java:3480)01-17 15:50:06.513: E/AndroIDRuntime(2544): at androID.vIEw.VIEw$PerformClick.run(VIEw.java:13983)01-17 15:50:06.513: E/AndroIDRuntime(2544): at androID.os.Handler.handleCallback(Handler.java:605)01-17 15:50:06.513: E/AndroIDRuntime(2544): at androID.os.Handler.dispatchMessage(Handler.java:92)01-17 15:50:06.513: E/AndroIDRuntime(2544): at androID.os.Looper.loop(Looper.java:137)01-17 15:50:06.513: E/AndroIDRuntime(2544): at androID.app.ActivityThread.main(ActivityThread.java:4340)01-17 15:50:06.513: E/AndroIDRuntime(2544): at java.lang.reflect.Method.invokeNative(Native Method)01-17 15:50:06.513: E/AndroIDRuntime(2544): at java.lang.reflect.Method.invoke(Method.java:511)01-17 15:50:06.513: E/AndroIDRuntime(2544): at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)01-17 15:50:06.513: E/AndroIDRuntime(2544): at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:551)01-17 15:50:06.513: E/AndroIDRuntime(2544): at dalvik.system.NativeStart.main(Native Method)01-17 15:50:06.513: E/AndroIDRuntime(2544): Caused by: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provIDer Failed: null01-17 15:50:06.513: E/AndroIDRuntime(2544): at oauth.signpost.AbstractOAuthProvIDer.retrIEvetoken(AbstractOAuthProvIDer.java:214)01-17 15:50:06.513: E/AndroIDRuntime(2544): at oauth.signpost.AbstractOAuthProvIDer.retrIEveRequestToken(AbstractOAuthProvIDer.java:69)01-17 15:50:06.513: E/AndroIDRuntime(2544): at com.Google.code.linkedinAPI.clIEnt.oauth.linkedInOAuthServiceImpl.getoAuthRequestToken(linkedInOAuthServiceImpl.java:196)01-17 15:50:06.513: E/AndroIDRuntime(2544): ... 18 more01-17 15:50:06.513: E/AndroIDRuntime(2544): Caused by: androID.os.networkonmainthreadException01-17 15:50:06.513: E/AndroIDRuntime(2544): at androID.os.StrictMode$AndroIDBlockGuardPolicy.onNetwork(StrictMode.java:1084)01-17 15:50:06.513: E/AndroIDRuntime(2544): at java.net.InetAddress.lookupHostByname(InetAddress.java:391)01-17 15:50:06.513: E/AndroIDRuntime(2544): at java.net.InetAddress.getAllBynameImpl(InetAddress.java:242)01-17 15:50:06.513: E/AndroIDRuntime(2544): at java.net.InetAddress.getAllByname(InetAddress.java:220)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpconnection.<init>(httpconnection.java:71)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpconnection.<init>(httpconnection.java:50)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpconnection$Address.connect(httpconnection.java:351)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpconnectionPool.get(httpconnectionPool.java:86)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpconnection.connect(httpconnection.java:128)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpEngine.openSocketConnection(httpEngine.java:308)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpsURLConnectionImpl$httpsEngine.makeSslConnection(httpsURLConnectionImpl.java:460)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpsURLConnectionImpl$httpsEngine.connect(httpsURLConnectionImpl.java:432)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpEngine.sendSocketRequest(httpEngine.java:282)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpEngine.sendRequest(httpEngine.java:232)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpURLConnectionImpl.connect(httpURLConnectionImpl.java:80)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpsURLConnectionImpl.connect(httpsURLConnectionImpl.java:164)01-17 15:50:06.513: E/AndroIDRuntime(2544): at oauth.signpost.basic.DefaultOAuthProvIDer.sendRequest(DefaultOAuthProvIDer.java:48)01-17 15:50:06.513: E/AndroIDRuntime(2544): at oauth.signpost.AbstractOAuthProvIDer.retrIEvetoken(AbstractOAuthProvIDer.java:177)
解决方法 在onCreate()中的setContentVIEw()之后添加以下函数.

[+++]

这对我有用.希望它能为你效劳.

总结

以上是内存溢出为你收集整理的android – Linkedin:oauth.signpost.exception.OAuthCommunicationException:与服务提供者通信失败:null全部内容,希望文章能够帮你解决android – Linkedin:oauth.signpost.exception.OAuthCommunicationException:与服务提供者的通信失败:null所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 166, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 30, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
android – Linkedin:oauth.signpost.exception.OAuthCommunicationException:与服务提供者的通信失败:null_app_内存溢出

android – Linkedin:oauth.signpost.exception.OAuthCommunicationException:与服务提供者的通信失败:null

android – Linkedin:oauth.signpost.exception.OAuthCommunicationException:与服务提供者的通信失败:null,第1张

概述我将在我的 Android应用程序中访问linkedin配置文件.我使用下面的代码,它在Android设备上工作正常,但在模拟器上崩溃.不知道问题出在哪里.我的代码如下. Config.java public class Config { public static String LINKEDIN_CONSUMER_KEY = "75rbbjsc94argh"; public s 我将在我的 Android应用程序中访问linkedin配置文件.我使用下面的代码,它在AndroID设备上工作正常,但在模拟器上崩溃.不知道问题出在哪里.我的代码如下.

Config.java

public class Config {    public static String linkEDIN_CONSUMER_KEY = "75rbbJsc94argh";    public static String linkEDIN_CONSUMER_SECRET = "G85WTKgcIijk4U6Yu";    public static String scopeParams = "rw_nus+r_basicprofile+r_fullprofile+r_emailaddress+r_network+r_contactinfo+rw_groups+rw_company_admin";    public static String OAUTH_CALLBACK_SCHEME = "x-oauthflow-linkedin";    public static String OAUTH_CALLBACK_HOST = "callback";    //public static String OAUTH_CALLBACK_URL = OAUTH_CALLBACK_SCHEME + "://" + OAUTH_CALLBACK_HOST;    public static String OAUTH_CALLBACK_URL = "x-oauthflow-linkedin://callback";}

linkedInSampleActivity.java

public class linkedInSampleActivity extends Activity {    button login;    button share;    EditText et;    TextVIEw name;    ImageVIEw photo;    public static final String OAUTH_CALLBACK_HOST = "litestcalback";    final linkedInOAuthService oAuthService = linkedInOAuthServiceFactory            .getInstance().createlinkedInOAuthService(                    Config.linkEDIN_CONSUMER_KEY,Config.linkEDIN_CONSUMER_SECRET,Config.scopeParams);    final linkedInapiclientFactory factory = linkedInapiclientFactory            .newInstance(Config.linkEDIN_CONSUMER_KEY,Config.linkEDIN_CONSUMER_SECRET);    linkedInRequestToken liToken;    linkedInapiclient clIEnt;    linkedInAccesstoken accesstoken = null;    @OverrIDe    public voID onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentVIEw(R.layout.main);        share = (button) findVIEwByID(R.ID.share);        name = (TextVIEw) findVIEwByID(R.ID.name);        et = (EditText) findVIEwByID(R.ID.et_share);        login = (button) findVIEwByID(R.ID.login);        photo = (ImageVIEw) findVIEwByID(R.ID.photo);        login.setonClickListener(new OnClickListener() {            @OverrIDe            public voID onClick(VIEw v) {                linkedInLogin();            }        });    }    private voID linkedInLogin() {        ProgressDialog progressDialog = new ProgressDialog(                linkedInSampleActivity.this);        linkedindialog d = new linkedindialog(linkedInSampleActivity.this,progressDialog);        d.show();        // set call back Listener to get oauth_verifIEr value        d.setVerifIErListener(new OnVerifyListener() {            @OverrIDe            public voID onVerify(String verifIEr) {                try {                    Log.i("linkedinSample","verifIEr: " + verifIEr);                    accesstoken = linkedindialog.oAuthService                            .getoAuthAccesstoken(linkedindialog.liToken,verifIEr);                    linkedindialog.factory.createlinkedInapiclient(accesstoken);                    clIEnt = factory.createlinkedInapiclient(accesstoken);                    clIEnt.postNetworkUpdate("Testing by Umesh!!! linkedIn wall post from AndroID app");                    Person p2 = clIEnt.getProfileForCurrentUser(EnumSet.of(ProfileFIEld.ID));                     Person p = clIEnt.getProfileByID(p2.getID(),EnumSet.of(                    ProfileFIEld.FirsT_name,ProfileFIEld.LAST_name,ProfileFIEld.SKILLS,ProfileFIEld.headliNE,ProfileFIEld.SUMMARY,ProfileFIEld.LANGUAGES,ProfileFIEld.LANGUAGES_LANGUAGE_name,ProfileFIEld.LANGUAGES_PROFICIENCY_name,ProfileFIEld.LANGUAGES_LANGUAGE,ProfileFIEld.HOnorS,ProfileFIEld.INTERESTS,ProfileFIEld.positionS,ProfileFIEld.EDUCATIONS,ProfileFIEld.INDUSTRY,ProfileFIEld.API_STANDARD_PROfile_REQUEST,ProfileFIEld.PICTURE_URL,ProfileFIEld.PUBliC_PROfile_URL));                    name.setText("Welcome " + p.getFirstname() + " "+ p.getLastname());                    Log.i("linkedinSample","ln_access_token: " + accesstoken.getToken());                    Log.i("linkedinSample","ln_access_token: " + accesstoken.getTokenSecret());                    Log.i("Firstname"," : " + p.getFirstname());                    Log.i("Lastname"," : " + p.getLastname());                    Log.i("User Summary"," : " + p.getSummary());                    Log.i("headline"," : " + p.getheadline());                    Log.i("Interest"," : "+p.getInterests());                    //----------------------------------------------------                    for (position position:p.getpositions().getpositionList())                    {                        Log.i("position "," : " + position.getTitle());                        Log.i("comp "," : " + position.getCompany().getname());                    }                    for (Education education:p.getEducations().getEducationList())                     {                        Log.i("Degree "," : "+ education.getDegree());                        Log.i("School name "," : "+ education.getSchoolname());                    }                    Log.i("Language "," : ");                    for(Language language:p.getLanguages().getLanguageList())                    {                        Log.i(""," : "+language.getLanguage().getname());                    }                    Log.i("Skill "," : ");                    for(Skill skill:p.getSkills().getSkillList())                    {                        Log.i(""," : "+skill.getSkill().getname());                    }                    Log.i("Honor"," : "+p.getHonors());                    //----------------------------------------------------                    name.setVisibility(0);                    login.setVisibility(4);                    share.setVisibility(0);                    et.setVisibility(0);                } catch (Exception e) {                    Log.i("linkedinSample","error to get verifIEr");                    e.printstacktrace();                }            }        });        // set progress dialog        progressDialog.setMessage("Loading...");        progressDialog.setCancelable(true);        progressDialog.show();    }}

linkedindialog.java

public class linkedindialog extends Dialog {    private ProgressDialog progressDialog = null;    public static linkedInapiclientFactory factory;    public static linkedInOAuthService oAuthService;    public static linkedInRequestToken liToken;    //Construct a new linkedIn dialog    public linkedindialog(Context context,ProgressDialog progressDialog) {        super(context);        this.progressDialog = progressDialog;    }    @OverrIDe    protected voID onCreate(Bundle savedInstanceState) {        requestwindowFeature(Window.FEATURE_NO_Title);// must call before super.        super.onCreate(savedInstanceState);        setContentVIEw(R.layout.ln_dialog);        setWebVIEw();    }    // set webvIEw.    private voID setWebVIEw() {        linkedindialog.oAuthService = linkedInOAuthServiceFactory.getInstance()                .createlinkedInOAuthService(Config.linkEDIN_CONSUMER_KEY,Config.linkEDIN_CONSUMER_SECRET);        linkedindialog.factory = linkedInapiclientFactory.newInstance(                Config.linkEDIN_CONSUMER_KEY,Config.linkEDIN_CONSUMER_SECRET);        linkedindialog.liToken = linkedindialog.oAuthService.getoAuthRequestToken(Config.OAUTH_CALLBACK_URL);        WebVIEw mWebVIEw = (WebVIEw) findVIEwByID(R.ID.webkitWebVIEw1);        mWebVIEw.getSettings().setJavaScriptEnabled(true);        Log.i("linkedinSample",linkedindialog.liToken.getAuthorizationUrl());        mWebVIEw.loadUrl(linkedindialog.liToken.getAuthorizationUrl());        mWebVIEw.setWebVIEwClIEnt(new HelloWebVIEwClIEnt());        mWebVIEw.setPictureListener(new PictureListener() {            @OverrIDe            public voID onNewPicture(WebVIEw vIEw,Picture picture) {                if (progressDialog != null && progressDialog.isShowing()) {                    progressDialog.dismiss();                }            }        });    }    //webvIEw clIEnt for internal url loading    class HelloWebVIEwClIEnt extends WebVIEwClIEnt {        @OverrIDe        public boolean shouldOverrIDeUrlLoading(WebVIEw vIEw,String url) {            if (url.contains(Config.OAUTH_CALLBACK_URL)) {                Uri uri = Uri.parse(url);                String verifIEr = uri.getqueryParameter("oauth_verifIEr");                cancel();                for (OnVerifyListener d : Listeners) {                    // call Listener method                    d.onVerify(verifIEr);                }            } else if (url.contains("https://www.linkedin.com/uas/oauth/redorangetechnologIEs.com")) {                cancel();            } else {                Log.i("linkedinSample","url: " + url);                vIEw.loadUrl(url);            }            return true;        }    }    /**     * List of Listener.     */    private List<OnVerifyListener> Listeners = new ArrayList<OnVerifyListener>();    /**     * Register a callback to be invoked when authentication have finished.     *      * @param data     *            The callback that will run     */    public voID setVerifIErListener(OnVerifyListener data) {        Listeners.add(data);    }    /**     * Listener for oauth_verifIEr.     */    interface OnVerifyListener {        /**         * invoked when authentication have finished.         *          * @param verifIEr         *            oauth_verifIEr code.         */        public voID onVerify(String verifIEr);    }}

应用程序崩溃,单击登录按钮,错误显示在setWebVIEw();在linkedindialog类中.

以下是logcat:

01-17 15:50:06.513: E/AndroIDRuntime(2544): FATAL EXCEPTION: main01-17 15:50:06.513: E/AndroIDRuntime(2544): com.Google.code.linkedinAPI.clIEnt.oauth.linkedInOAuthServiceException: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provIDer Failed: null01-17 15:50:06.513: E/AndroIDRuntime(2544):     at com.Google.code.linkedinAPI.clIEnt.oauth.linkedInOAuthServiceImpl.getoAuthRequestToken(linkedInOAuthServiceImpl.java:205)01-17 15:50:06.513: E/AndroIDRuntime(2544):     at com.mukesh.linkedin.linkedindialog.setWebVIEw(linkedindialog.java:65)01-17 15:50:06.513: E/AndroIDRuntime(2544):     at com.mukesh.linkedin.linkedindialog.onCreate(linkedindialog.java:54)01-17 15:50:06.513: E/AndroIDRuntime(2544):     at androID.app.Dialog.dispatchOnCreate(Dialog.java:340)01-17 15:50:06.513: E/AndroIDRuntime(2544):     at androID.app.Dialog.show(Dialog.java:253)01-17 15:50:06.513: E/AndroIDRuntime(2544):     at com.mukesh.linkedin.linkedInSampleActivity.linkedInLogin(linkedInSampleActivity.java:100)01-17 15:50:06.513: E/AndroIDRuntime(2544):     at com.mukesh.linkedin.linkedInSampleActivity.access
if (androID.os.Build.VERSION.SDK_INT > 9) {        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy);        }
(linkedInSampleActivity.java:94)01-17 15:50:06.513: E/AndroIDRuntime(2544): at com.mukesh.linkedin.linkedInSampleActivity.onClick(linkedInSampleActivity.java:69)01-17 15:50:06.513: E/AndroIDRuntime(2544): at androID.vIEw.VIEw.performClick(VIEw.java:3480)01-17 15:50:06.513: E/AndroIDRuntime(2544): at androID.vIEw.VIEw$PerformClick.run(VIEw.java:13983)01-17 15:50:06.513: E/AndroIDRuntime(2544): at androID.os.Handler.handleCallback(Handler.java:605)01-17 15:50:06.513: E/AndroIDRuntime(2544): at androID.os.Handler.dispatchMessage(Handler.java:92)01-17 15:50:06.513: E/AndroIDRuntime(2544): at androID.os.Looper.loop(Looper.java:137)01-17 15:50:06.513: E/AndroIDRuntime(2544): at androID.app.ActivityThread.main(ActivityThread.java:4340)01-17 15:50:06.513: E/AndroIDRuntime(2544): at java.lang.reflect.Method.invokeNative(Native Method)01-17 15:50:06.513: E/AndroIDRuntime(2544): at java.lang.reflect.Method.invoke(Method.java:511)01-17 15:50:06.513: E/AndroIDRuntime(2544): at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)01-17 15:50:06.513: E/AndroIDRuntime(2544): at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:551)01-17 15:50:06.513: E/AndroIDRuntime(2544): at dalvik.system.NativeStart.main(Native Method)01-17 15:50:06.513: E/AndroIDRuntime(2544): Caused by: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provIDer Failed: null01-17 15:50:06.513: E/AndroIDRuntime(2544): at oauth.signpost.AbstractOAuthProvIDer.retrIEvetoken(AbstractOAuthProvIDer.java:214)01-17 15:50:06.513: E/AndroIDRuntime(2544): at oauth.signpost.AbstractOAuthProvIDer.retrIEveRequestToken(AbstractOAuthProvIDer.java:69)01-17 15:50:06.513: E/AndroIDRuntime(2544): at com.Google.code.linkedinAPI.clIEnt.oauth.linkedInOAuthServiceImpl.getoAuthRequestToken(linkedInOAuthServiceImpl.java:196)01-17 15:50:06.513: E/AndroIDRuntime(2544): ... 18 more01-17 15:50:06.513: E/AndroIDRuntime(2544): Caused by: androID.os.networkonmainthreadException01-17 15:50:06.513: E/AndroIDRuntime(2544): at androID.os.StrictMode$AndroIDBlockGuardPolicy.onNetwork(StrictMode.java:1084)01-17 15:50:06.513: E/AndroIDRuntime(2544): at java.net.InetAddress.lookupHostByname(InetAddress.java:391)01-17 15:50:06.513: E/AndroIDRuntime(2544): at java.net.InetAddress.getAllBynameImpl(InetAddress.java:242)01-17 15:50:06.513: E/AndroIDRuntime(2544): at java.net.InetAddress.getAllByname(InetAddress.java:220)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpconnection.<init>(httpconnection.java:71)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpconnection.<init>(httpconnection.java:50)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpconnection$Address.connect(httpconnection.java:351)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpconnectionPool.get(httpconnectionPool.java:86)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpconnection.connect(httpconnection.java:128)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpEngine.openSocketConnection(httpEngine.java:308)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpsURLConnectionImpl$httpsEngine.makeSslConnection(httpsURLConnectionImpl.java:460)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpsURLConnectionImpl$httpsEngine.connect(httpsURLConnectionImpl.java:432)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpEngine.sendSocketRequest(httpEngine.java:282)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpEngine.sendRequest(httpEngine.java:232)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpURLConnectionImpl.connect(httpURLConnectionImpl.java:80)01-17 15:50:06.513: E/AndroIDRuntime(2544): at libcore.net.http.httpsURLConnectionImpl.connect(httpsURLConnectionImpl.java:164)01-17 15:50:06.513: E/AndroIDRuntime(2544): at oauth.signpost.basic.DefaultOAuthProvIDer.sendRequest(DefaultOAuthProvIDer.java:48)01-17 15:50:06.513: E/AndroIDRuntime(2544): at oauth.signpost.AbstractOAuthProvIDer.retrIEvetoken(AbstractOAuthProvIDer.java:177)
解决方法 在onCreate()中的setContentVIEw()之后添加以下函数.

这对我有用.希望它能为你效劳.

总结

以上是内存溢出为你收集整理的android – Linkedin:oauth.signpost.exception.OAuthCommunicationException:与服务提供者通信失败:null全部内容,希望文章能够帮你解决android – Linkedin:oauth.signpost.exception.OAuthCommunicationException:与服务提供者的通信失败:null所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1122996.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存