2016年9月26日 星期一

Google Domains信用卡無法結帳(You appear to be in a country where Google Domains is not yet available.)

之前買的Google Domains服務快到期了,於是再去購買,只是會出現如下的錯誤訊息:
Oops! We couldn't checkout your cart. Please try again later. 
這時才想起來,去年也是卡在這裡,而且還有另一個訊息:
You appear to be in a country where Google Domains is not yet available.
記得只要把地址改一改就行了,於是就去Google Wallet去改信用卡的地址,只是改完後,還是一樣無法結帳。
後來只好按下這一串You appear to be in a country where Google Domains is not yet available.後方的Learn more,就會顯示一個對話框:

接著選 Wait, i have a US  Billing address.然後就會有個介面跳到改信用卡的地址或增加信用卡,我再增加一張信用卡就可以買了,地址別忘了要美國的地址,奇怪的地方在於增加的信用卡是重復輸入的,改的也是Google Wallet的設定。但自己去Google Wallet改好像沒用。

2016年9月10日 星期六

play-games-plugin-for-unity 與 googleads-mobile-unity 混用

雖然有人把google play services和admob的Unity3D plugin都寫好了,但同時使用也是要動手微調一下,不然可能就會碰到以下2種錯誤。
Failed to re-package resources
Unable to convert classes into dex format
先把Unity和plugin的版本列出

Unity3D 5.3

Unity3D的google play services plugin 0.9.34
https://github.com/playgameservices/play-games-plugin-for-unity

Unity3D的admob plugin 3.0.5
https://github.com/googleads/googleads-mobile-unity/releases

將2種plugin合起來用需要做些修改,可參考以下網址:
https://ndesostyle.wordpress.com/2016/02/10/conflict-with-latest-googleads-mobile-and-play-games-plugin-for-unity/

網頁上的重點是這一段字後面的影片連結:
Fixing google play games and admob plugin Unity. Video tutorial is Available  Youtube

可惜裡面用的版本有點舊了,我再把改的過程記錄一下。

1.先裝play-games-plugin-for-unity,若碰到
Unity3D No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').
錯誤,可先看之前這篇的方法
http://chadgod.blogspot.tw/2016/09/unity3d-no-resource-found-that-matches.html
沒問題後再把admob plugin裝上

2.打開Assets/GooglePlayGames/Editor/GPGSUpgrader.cs
在97行的地方把以下2行註解掉
//string clientDir = "Assets/Plugins/Android/google-play-services_lib";
//GPGSUtil.DeleteDirIfExists(clientDir);

3.打開Assets/GooglePlayGames/Editor/GPGSDependencies.cs
在67行的地方註解掉
//svcSupport.DependOn("com.android.support",
//"support-v4",
//"23.1+");
後面加上
svcSupport.DependOn("com.google.android.gms",
"play-services-ads",
PluginVersion.PlayServicesVersionConstraint);

4.打開Assets/Plugins/Android/GoogleMobileAdsPlugin/AndroidManifest.xml
在23~25行註解掉
<!-- <activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" /> -->

5.改好後回到Unity3D編輯器會跳出一個對話框內容如下
Remove or replace support-v4 version 23.4.0 with version 23.1.1?
我選了ok

6.這時就可以先Build看看了,若成功就可以到以下網址看Unity的admob範例
https://developers.google.com/mobile-ads-sdk/docs/games?hl=zh-tw#unity

7.若失敗也只能在找看看有沒有其它方法了,附上使用的android sdk,提供一些線索。
Tools
Android SDK Tools 25.1.7
Android SDK Platform-tools 24.0.2
Android SDK Build-tools 23.0.2

Android 6.0

Extras
Android Support Repository 36
Google Play services 32
Google Repository 32
Google Play APK Expansion library 1
Google Play Licensing Library 1
Intel x86 Emulator Accelerator(HAXM installer) 6.0.3



2016年9月8日 星期四

Unity3D No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').


在Unity3D 5.3 加上google play service的功能會先去下載下面的plugin
https://github.com/playgameservices/play-games-plugin-for-unity
不意外的,又有如標題的錯誤了.

大部份解法都是去android sdk目錄下的 extras\google\google_play_services 找檔案來用,但我實在是找不到那些神奇的檔案。
不過下面這個網址倒是有不一樣的解法,可以參考看看
https://app-c.net/tutorial/unity/version5_2/

他是直接把 @integer/google_play_services_version 這變數換成字串,如下
<meta-data android:name="com.google.android.gms.version"
android:value="4323000" />

到這裡可以編釋了,過了一段時間回頭看這個值又變回@integer/google_play_services_version了,估計是在
Window->GooglePlayGames->setup->Android setup...
的設定完成後就變回去了,所以說不定一開始把這個欄位刪除也可以先編釋。

順便提一下使用EnableSaveGames()碰到的問題:
在設定PlayGamesClientConfiguration時,有加上EnableSaveGames(),而且
在google play開發平台上該設定的都有設定,但登入後遊戲就是會跳掉,那麼可參考如下:
https://developers.google.com/games/services/console/configuring
其實就是進入手機上的設定->應用程式->Google Play 服務->管理空間->清除所有資料。
就沒問題了。害我以為改錯什麼,又浪費了我好幾個小時...