java - Android : reading googledrive privatekey.p12 error -


i trying xxxxxxxxxxxprivatekey.p12 path main folder of project. showing following error.i fed searching solution this.where store google drive private key file , how path.here snapshot of project file hierarchy , error details.any appriciated.thanks. example code took here!

    private drive getdriveservice(googleaccountcredential credential) { return new drive.builder(androidhttp.newcompatibletransport(), new gsonfactory(), credential)     .build();       } public static drive getdriveservice() throws generalsecurityexception, ioexception, urisyntaxexception { httptransport httptransport = new nethttptransport(); jacksonfactory jsonfactory = new jacksonfactory(); googlecredential credential = new googlecredential.builder() .settransport(httptransport) .setjsonfactory(jsonfactory) .setserviceaccountid(service_account_email) .setserviceaccountscopes(drivescopes.drive) .setserviceaccountprivatekeyfromp12file(     new java.io.file(service_account_pkcs12_file_path)) .build(); drive service = new drive.builder(httptransport, jsonfactory, null) .sethttprequestinitializer(credential).build(); return service; } 

errorlog :

     05-19 20:36:58.914: w/system.err(5175): java.io.filenotfoundexception: /xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-privatekey.p12: open failed: enoent (no such file or directory)    05-19 20:36:58.923: w/system.err(5175):  @           libcore.io.iobridge.open(iobridge.java:416)    05-19 20:36:58.923: w/system.err(5175):  @ java.io.fileinputstream.<init>(fileinputstream.java:78)    05-19 20:36:58.923: w/system.err(5175):  @ com.google.api.client.auth.security.privatekeys.loadfromp12file(privatekeys.java:178)    05-19 20:36:58.933: w/system.err(5175):  @ com.google.api.client.googleapis.auth.oauth2.googlecredential$builder.setserviceaccountprivatekeyfromp12file(googlecredential.java:541)    05-19 20:36:58.933: w/system.err(5175):  @ com.example.drivequickstart.mainactivity.getdriveservice(mainactivity.java:172)    05-19 20:36:58.933: w/system.err(5175):  @ com.example.drivequickstart.mainactivity.oncreate(mainactivity.java:57)    05-19 20:36:58.933: w/system.err(5175):  @ android.app.activity.performcreate(activity.java:5104)    05-19 20:36:58.933: w/system.err(5175):  @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1080)    05-19 20:36:58.933: w/system.err(5175):  @ android.app.activitythread.performlaunchactivity(activitythread.java:2144)    05-19 20:36:58.933: w/system.err(5175):  @ android.app.activitythread.handlelaunchactivity(activitythread.java:2230)    05-19 20:36:58.933: w/system.err(5175):  @ android.app.activitythread.access$600(activitythread.java:141)    05-19 20:36:58.933: w/system.err(5175):  @ android.app.activitythread$h.handlemessage(activitythread.java:1234)    05-19 20:36:58.943: w/system.err(5175):  @ android.os.handler.dispatchmessage(handler.java:99)   05-19 20:36:58.943: w/system.err(5175):   @ android.os.looper.loop(looper.java:137)   05-19 20:36:58.943: w/system.err(5175):   @ android.app.activitythread.main(activitythread.java:5041)  05-19 20:36:58.943: w/system.err(5175):    @ java.lang.reflect.method.invokenative(native method)  05-19 20:36:58.943: w/system.err(5175):    @ java.lang.reflect.method.invoke(method.java:511)  05-19 20:36:58.943: w/system.err(5175):    @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793)   05-19 20:36:58.943: w/system.err(5175):   @  com.android.internal.os.zygoteinit.main(zygoteinit.java:560)   05-19 20:36:58.953: w/system.err(5175):   @ dalvik.system.nativestart.main(native method)   05-19 20:36:58.953: w/system.err(5175): caused by: libcore.io.errnoexception: open failed: enoent (no such file or directory)    05-19 20:36:58.963: w/system.err(5175):  @ libcore.io.posix.open(native method)   05-19 20:36:58.963: w/system.err(5175):   @ libcore.io.blockguardos.open(blockguardos.java:110)  05-19 20:36:58.963: w/system.err(5175):    @ libcore.io.iobridge.open(iobridge.java:400)  05-19 20:36:58.963: w/system.err(5175):    ... 19 more  05-19 20:36:59.413: d/gralloc_goldfish(5175): emulator without gpu emulation detected. 


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -