I’m trying to build an app for my store.
downloaded the sample app from github (mobile-buy-sdk-android)
but when I try to run it it gives this error and crashes:
FATAL EXCEPTION: main
Process: com.shopify.sample, PID: 4157
java.lang.RuntimeException: Unable to create application com.shopify.sample.application.SampleApplication: java.lang.IllegalArgumentException:
Add your shop credentials to a shop.properties file in the main app folder (e.g. ‘app/shop.properties’). Include these keys:
SHOP_DOMAIN=.myshopify.com
API_KEY=0123456789abcdefghijklmnopqrstuvw
You must populate the ‘APP_ID’ entry in app/shop.properties
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4559)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5257)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.IllegalArgumentException:
Add your shop credentials to a shop.properties file in the main app folder (e.g. ‘app/shop.properties’). Include these keys:
SHOP_DOMAIN=.myshopify.com
API_KEY=0123456789abcdefghijklmnopqrstuvw
You must populate the ‘APP_ID’ entry in app/shop.properties
at com.shopify.sample.application.SampleApplication.initializeBuyClient(SampleApplication.java:125)
at com.shopify.sample.application.SampleApplication.onCreate(SampleApplication.java:109)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1012)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4556)
2
Answers
Please, read carefully debug log. The answer is there:
Their sample app comment is slightly out of date. The location you need to put the shop.properties file is:
You need to put the API key / domain in
If you are still having problems, then just modify the SampleApplication.java and change the lines t