Format specifier: d

76 views
Skip to first unread message

redpan...@gmail.com

unread,
Aug 24, 2017, 5:21:48 PM8/24/17
to App Inventor Open Source Development
Hello, I could solve my "no such class" error by changing com.redpanda.wolframAlpha to com.redpanda.wolframalpha. I don't know why app inventor did not accept my lowerCamelCase, it works for other extensions. Now I have the problem that
1. My app crashes, when it tries to execute blocks of my extension
2. It shows the error "Format specifier: d"
I tried to restart it, but it does not help. I really want to write extensions, but now it's frustrating.

I hope you can help, Red Panda

Evan Patton

unread,
Aug 24, 2017, 5:35:17 PM8/24/17
to App Inventor Open Source Development
Hi Red Panda,


On Thursday, August 24, 2017 at 5:21:48 PM UTC-4, redpan...@gmail.com wrote:
Hello, I could solve my "no such class" error by changing com.redpanda.wolframAlpha to com.redpanda.wolframalpha. I don't know why app inventor did not accept my lowerCamelCase, it works for other extensions. Now I have the problem that
1. My app crashes, when it tries to execute blocks of my extension

We follow standard Java conventions, so if com.redpanda.wolframalpha is a class, it should be named com.redpanda.WolframAlpha. This might be due to older versions of the extension being on your phone. To verify, you can use adb or a file manager to delete the App Inventor directory from your sdcard or internal storage to remove any existing extensions that have been transferred to the device and may interfere with proper class loading.
 
2. It shows the error "Format specifier: d"

It is unclear where this might be coming from. You should use adb logcat to obtain a stack trace where the error occurred in the code and share it here. Otherwise, there's not much we can do for you.

Cheers,
Evan

redpan...@gmail.com

unread,
Aug 25, 2017, 6:18:10 PM8/25/17
to App Inventor Open Source Development
I'm not sure if you understood me right. I changed my package name to com.redpanda.wolframalpha and the no such class error was gone. I could reproduce the error, even with lowerCamelCase the no such class error appears. Changing the package name to lower case solves this problem, but then the "Format specifier: d" error apears.

Evan Patton

unread,
Aug 28, 2017, 5:16:47 PM8/28/17
to App Inventor Open Source Development
The convention in Java is for packages to be reverse domain names, which are lower case, so it's not a surprise to me that something somewhere breaks if you use a package name that breaks that convention.

I'm not sure where the error message regarding the format specifier is coming from. The easiest way to determine that would be to use adb logcat to get a stack trace and that will identify the line of code that is causing the problem and we can work backward from there to help you solve it.

Evan

redpan...@gmail.com

unread,
Aug 30, 2017, 11:05:54 AM8/30/17
to App Inventor Open Source Development
I did a logcat test and here is my error message:

--------- beginning of crash                                                                                            08-30 17:02:05.793 29751 29751 E AndroidRuntime: FATAL EXCEPTION: main                                                  08-30 17:02:05.793 29751 29751 E AndroidRuntime: Process: com.thunkable.appinventor.aicompanion3, PID: 29751            08-30 17:02:05.793 29751 29751 E AndroidRuntime: java.util.MissingFormatArgumentException: Format specifier: d          08-30 17:02:05.793 29751 29751 E AndroidRuntime:        at java.util.Formatter.getArgument(Formatter.java:1111)         08-30 17:02:05.793 29751 29751 E AndroidRuntime:        at java.util.Formatter.doFormat(Formatter.java:1076)            08-30 17:02:05.793 29751 29751 E AndroidRuntime:        at java.util.Formatter.format(Formatter.java:1042)              08-30 17:02:05.793 29751 29751 E AndroidRuntime:        at java.util.Formatter.format(Formatter.java:1011)              08-30 17:02:05.793 29751 29751 E AndroidRuntime:        at java.lang.String.format(String.java:1554)                    08-30 17:02:05.793 29751 29751 E AndroidRuntime:        at java.lang.String.format(String.java:1528)                    08-30 17:02:05.793 29751 29751 E AndroidRuntime:        at com.google.appinventor.components.runtime.util.ErrorMessages.formatMessage(ErrorMessages.java:555)                                                                                   08-30 17:02:05.793 29751 29751 E AndroidRuntime:        at com.google.appinventor.components.runtime.Form$3.run(Form.java:856)                                                                                                                  08-30 17:02:05.793 29751 29751 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:746)          08-30 17:02:05.793 29751 29751 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:95)          08-30 17:02:05.793 29751 29751 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:148)                      08-30 17:02:05.793 29751 29751 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:5443)    08-30 17:02:05.793 29751 29751 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)               08-30 17:02:05.793 29751 29751 E AndroidRuntime:        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)                                                                                                      08-30 17:02:05.793 29751 29751 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 08-30 17:02:05.853  1804  3023 W ActivityManager:   Force finishing activity com.thunkable.appinventor.aicompanion3/.Screen1  

I hope it helps.

Evan Patton

unread,
Aug 30, 2017, 11:16:53 AM8/30/17
to App Inventor Open Source Development
Do you have the same issue if you use the MIT App Inventor companion?

Evan

redpan...@gmail.com

unread,
Aug 30, 2017, 4:54:07 PM8/30/17
to App Inventor Open Source Development
Yes, I just hadn't the companion at hand. I can give you the crash code of the AI Companion if that matters.

Evan Patton

unread,
Sep 1, 2017, 12:38:40 PM9/1/17
to App Inventor Open Source Development
We don't have access to Thunkable's sources, so we will need you to send us a stack trace from the MIT App Inventor companion to confirm any issue. Also, are there any places in your code where you are triggering an error message? If you could show us the relevant lines that would help because my immediate thought is that this error is due to an incorrect number or sequence of arguments to dispatchErrorOccurredEvent.

Evan
Message has been deleted

redpan...@gmail.com

unread,
Sep 1, 2017, 4:06:54 PM9/1/17
to App Inventor Open Source Development
Here they are

E/AndroidRuntime(23615): FATAL EXCEPTION: main
E/AndroidRuntime(23615): java.util.MissingFormatArgumentException: Format specifier: d                                 
E/AndroidRuntime(23615):        at java.util.Formatter.getArgument(Formatter.java:1131)                                
E/AndroidRuntime(23615):        at java.util.Formatter.doFormat(Formatter.java:1096)                                   
E/AndroidRuntime(23615):        at java.util.Formatter.format(Formatter.java:1062)                                     
E/AndroidRuntime(23615):        at java.util.Formatter.format(Formatter.java:1031)                                     
E/AndroidRuntime(23615):        at java.lang.String.format(String.java:2177)                                           
E/AndroidRuntime(23615):        at java.lang.String.format(String.java:2151)                                           
E/AndroidRuntime(23615):        at com.google.appinventor.components.runtime.util.ErrorMessages.formatMessage(ErrorMessages.java:526)                                      
E/AndroidRuntime(23615):        at com.google.appinventor.components.runtime.Form$3.run(Form.java:808)                
E/AndroidRuntime(23615):        at android.os.Handler.handleCallback(Handler.java:587)                                 
E/AndroidRuntime(23615):        at android.os.Handler.dispatchMessage(Handler.java:92)                                 
E/AndroidRuntime(23615):        at android.os.Looper.loop(Looper.java:130)                                             
E/AndroidRuntime(23615):        at android.app.ActivityThread.main(ActivityThread.java:3687)                           
E/AndroidRuntime(23615):        at java.lang.reflect.Method.invokeNative(Native Method)                                
E/AndroidRuntime(23615):        at java.lang.reflect.Method.invoke(Method.java:507)                                    
E/AndroidRuntime(23615):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)     
E/AndroidRuntime(23615):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)                        
E/AndroidRuntime(23615):        at dalvik.system.NativeStart.main(Native Method) 
 
It seems that you are right. Note that I used another device than the last time. I have three procedures which look like this.:

if (appID.equals("")){
      form.dispatchErrorOccurredEvent(WolframAlpha.this, "RequestSpoken",
          3300); //No API Key
      return;
    }

    AsynchUtil.runAsynchronously(new Runnable() {
      @Override
      public void run() {
        try {
          performRequest("v1/spoken", "", "", "", "", "", requestText);
          currentAPI = "spoken";
        } catch (IOException e) {
          form.dispatchErrorOccurredEvent(WolframAlpha.this, "RequestSpoken",
              3300); //No connection
        } catch (JSONException je) {
          form.dispatchErrorOccurredEvent(WolframAlpha.this, "RequestSpoken",
              3300); //Could not parse JSON
        }
      }
    });

redpan...@gmail.com

unread,
Sep 11, 2017, 10:33:15 AM9/11/17
to App Inventor Open Source Development
Any updates on this?
Reply all
Reply to author
Forward
0 new messages