2012-10-03 32 views
1

我嘗試使用這些指令在模擬器上安裝android market - How to install android market on emulator for all api's,但重新啓動模擬器後,所有更改都將丟失。如何在模擬器上安裝android市場

In other guide,我讀到我需要從設備avd文件夾中刪除一些.img文件,但它不起作用。我還有什麼可以將市場永久安裝到仿真器上?

+0

Play商店(也稱爲Android電子市場)不適用於模擬器。它僅適用於許可設備製造商。請不要盜版軟件,就像這個問題的當前答案中提出的那樣。 – CommonsWare

+0

目的是什麼?您的應用程序是否會在模擬器上崩潰,因爲您想將用戶引導至商店 - 或者您想要獲取應用程序嗎? –

+0

你可以下載這個最新的Play商店APK:[下載](https://dl.dropbox.com/u/90690956/com.android.vending.8014017.apk)下載後像往常一樣安裝它。 –

回答

2

正如你告訴我你需要這個測試目的,我認爲這是不值得的麻煩。難道你不知道任何有Android設備的人來測試它嗎?我知道這不是你期望的答案 - 但是因爲它建議在真實設備上測試 - 無論如何 - 在這裏我的建議:

我一直在市場上使用這個代碼的幾個應用程序正常工作:

public static void goToMarket(Context context){ 
    Intent it = new Intent(Intent.ACTION_VIEW); 
    it.setData(Uri.parse(context.getString(R.string.playstorelink))); 
    context.startActivity(it); 
} 

字符串中的鏈接看起來是這樣的:市場://細節ID = com.google.zxing.client.android

爲了防止這種情況的代碼崩潰的模擬器(顯然沒有PlayStore),你可以將這段代碼包裝在try catch博客中:

catch (ActivityNotFoundException e) { 
     // Do something 
} 
+0

謝謝你的一段代碼。其中一個問題是找到適合市場的uri的有效形式,我發現它通過emalator上的一些測試迭代。另外,如果開放市場失敗,我添加了一些代碼來打開市場低谷http。 – kruz05

+0

代碼: 嘗試意圖marketIntent = new Intent(Intent.ACTION_VIEW,Uri.parse(「market:// details?id =」+ googlePlayAppName)); gameActivity.startActivity(marketIntent);} catch(ActivityNotFoundException anfe){ try {intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(「https://play.google.com/store/apps/details?id=」+ googlePlayAppName) ); gameActivity.startActivity(intent); } catch(Exception e){} } catch(Exception e){} – kruz05