简体   繁体   English

如何以编程方式从Google Play下载APK文件?

[英]How to download APK file from Google Play programmatically?

I want to download a few applications from Google Play to my phone. 我想将一些应用程序从Google Play下载到我的手机上。 I try follow answer Download App from Google Play programatically , but have an exceptions: java.lang.NoSuchMethodError: org.apache.http.conn.scheme.Scheme.<init> or java.lang.NoSuchMethodError: No direct method <init>(Ljava/lang/String;ILorg/apache/http/conn/scheme/SchemeSocketFactory;)V in class Lorg/apache/http/conn/scheme/Scheme; or its super classes (declaration of 'org.apache.http.conn.scheme.Scheme' appears in /system/framework/org.apache.http.legacy.boot.jar) 我尝试按照编程方式从Google Play上下载答案,但有一个例外: java.lang.NoSuchMethodError: org.apache.http.conn.scheme.Scheme.<init>java.lang.NoSuchMethodError: No direct method <init>(Ljava/lang/String;ILorg/apache/http/conn/scheme/SchemeSocketFactory;)V in class Lorg/apache/http/conn/scheme/Scheme; or its super classes (declaration of 'org.apache.http.conn.scheme.Scheme' appears in /system/framework/org.apache.http.legacy.boot.jar) java.lang.NoSuchMethodError: No direct method <init>(Ljava/lang/String;ILorg/apache/http/conn/scheme/SchemeSocketFactory;)V in class Lorg/apache/http/conn/scheme/Scheme; or its super classes (declaration of 'org.apache.http.conn.scheme.Scheme' appears in /system/framework/org.apache.http.legacy.boot.jar) . java.lang.NoSuchMethodError: No direct method <init>(Ljava/lang/String;ILorg/apache/http/conn/scheme/SchemeSocketFactory;)V in class Lorg/apache/http/conn/scheme/Scheme; or its super classes (declaration of 'org.apache.http.conn.scheme.Scheme' appears in /system/framework/org.apache.http.legacy.boot.jar) And it problem is library. 问题是图书馆。 Also I try use android-market-api , but also have exception because ClientLogin is deprecated. 我也尝试使用android-market-api ,但是也有例外,因为不建议使用ClientLogin。

There is no official API to download APKs programmatically. 没有官方API可通过编程方式下载APK。 But to address your exception, it seems like you're using Apache HTTP Client and running your app on a device with Android Marshmallow (6.0) or above. 但是要解决您的异常,似乎您正在使用Apache HTTP Client,并在装有Android Marshmallow(6.0)或更高版本的设备上运行您的应用程序。

Apache HTTP Client has been removed as of Marshmallow. 自棉花糖起,Apache HTTP Client 已被删除 HttpURLConnection can be used instead. 可以改用HttpURLConnection

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM