Rush • A new and improved way of building extensions

Hi,

You can import that class by adding the original AndroidRuntime.jar from the AI2 extension template as your extension's compile-time dependency. In Rush, to add any JAR as a compile-time dependency, just add it inside the deps directory but don't include it in the rush.yml file.

PS: You can get the AndroidRuntime.jar from here: https://github.com/mit-cml/extension-deps/blob/master/AndroidRuntime.jar

That worked, thanks @shreyash.

1 Like

#Off Topic

What is the meaning of this :sweat_smile::sweat_smile:

From Latin: "Post Scriptum" - After written

3 Likes

#offtopic

P.S. is a footnote. It includes additional information.

2 Likes

It can be used with some more variations

Here @ABG has used some programming skills and applied nesting with "Post Script".

P.S., P.P.S., P.P.P.S... :smiley:

Edit: Pls read this Post as #offtopic

2 Likes

My Rush build is failing again and again.

While i understand that in my profile i have space but how do I ignore the same. "C:\users\amrish shah".

How doi ignore space while building / compiling.

┌ Checking project files
│ info Checking metadata file (rush.yml)
│ info Checking AndroidManifest.xml file
└ done
┌ Compiling sources
│ info Picked 1 source file
│ erro invalid flag: Shah\AppData\Roaming\rush\workspaces\io.amrish.test\classes
│ Usage: javac
│ use --help for a list of possible options
└ failed

This is a known bug and will be fixed in a future release. Until then, try this workaround:

  1. Copy/Move everything inside the Rush data directory (located at C:\Users\amrish shah\AppData\Roaming\rush) to a place whose path has no whitespace, for e.g., C:\rush.
  2. Then, create a new environment variable named RUSH_DATA_DIR and set it equal to the path of the new data directory.
  3. Build your extension with rush build.
1 Like

@shreyash i am using your rush since long... but these days i am encountering an error while using proguard in rush

while i dont have any argument in my simple event

@SimpleEvent
  public void OnInitialised(){
    EventDispatcher.dispatchEvent(this,"OnInitialised");
  }

Also when i remove proguard extension works fine

My proguard file code:-

# Add any ProGuard configurations specific to this
# extension here.

-keep public class in.akshatt.UnityAds.UnityAds {
    public *;
 }
-keeppackagenames gnu.kawa**, gnu.expr**

-optimizationpasses 4
-allowaccessmodification
-mergeinterfacesaggressively

-repackageclasses 'in/akshatt/UnityAds/repack'
-flattenpackagehierarchy
-dontpreverify

#by me :)

-keepattributes SourceFile,LineNumberTable


-keepattributes JavascriptInterface


-keep class android.webkit.JavascriptInterface {
   *;
}


-keep class com.unity3d.ads.** {
   *;
}

-keep class com.unity3d.services.** {
   *;
}

-dontwarn com.google.**
-dontwarn com.unity3d.**

2 Likes

And @shreyash please make it usable for Git Bash too
Means creating extension using Git Bash

It doesn't look like it has anything to do with ProGuard. Is this extension being tested in the companion? If yes, make sure that you restart the companion connection every time you make changes in the extension. In some cases, you might even need to delete the companion's directory from your Android device.

Seems like the issue doesn't have to do with the intialization of the method itself, but rather from where you call the method. Could you please send that?

I tested it both in companion and real apk and results are same
.. but as i said...

by this reason i am suspecting proguard

1 Like
com.unity3d.ads.UnityAds.initialize(context, gameID, testMode, new IUnityAdsInitializationListener() {

      @Override

      public void onInitializationComplete() {

        OnInitialised();

      }

      @Override

      public void onInitializationFailed(com.unity3d.ads.UnityAds.UnityAdsInitializationError unityAdsInitializationError, String s) {

        switch (unityAdsInitializationError) {

          case INTERNAL_ERROR:

            OnInitialiseFailed("InternalError", s);

            break;

          case INVALID_ARGUMENT:

            OnInitialiseFailed("InvalidArgument", s);

            break;

          case AD_BLOCKER_DETECTED:

            OnInitialiseFailed("ADBlockerDetected", s);

            break;

        }

      }

    });

That's weird: your code doesn't provide any arguments, but the error says there are 2. It might have to do with ProGuard, then.

1 Like

yes thats the main thing i think here @shreyash can help neither my event has any arguments nor the initialisation method

PM me a demo app containing your extension.

Can you try changing name of your extension to UnityAd only and not UnityAds it might be conflicting with the ads class.

4 Likes

does Rush support @Options annotation?
I am trying to make a extension with helper block using @Options annotation like:

    @SimpleProperty
	public void RepeatMode(@Options(RepeatMode.class) int mode) {
		this.repeatMode = mode;
	}

	@SimpleProperty
	public @Options(RepeatMode.class) int RepeatMode() {
		return this.repeatMode;
	}

but build failed:

 Build initialized

┌ Checking project files
│ info Checking metadata file (rush.yml)
│ info Checking AndroidManifest.xml file
└ done
┌ Compiling sources
│ info Picked 2 source files
│      src\cn\kevinkun\Tween\RepeatMode.java:6: 错误: 找不到符号
│      import com.google.appinventor.components.common.OptionList;
│                                                     ^
│        符号:   类 OptionList
│        位置: 程序包 com.google.appinventor.components.common
│      src\cn\kevinkun\Tween\RepeatMode.java:8: 错误: 找不到符号
│      public enum RepeatMode implements OptionList<Integer> {
│                                        ^
│        符号: 类 OptionList
│      src\cn\kevinkun\Tween\Tween.java:3: 错误: 找不到符号
│      import com.google.appinventor.components.annotations.Options;
│                                                          ^
│        符号:   类 Options
│        位置: 程序包 com.google.appinventor.components.annotations
│      src\cn\kevinkun\Tween\Tween.java:48: 错误: 找不到符号
│       public void RepeatMode(@Options(RepeatMode.class) int mode) {
│                               ^
│        符号:   类 Options
│        位置: 类 Tween
│      src\cn\kevinkun\Tween\Tween.java:53: 错误: 找不到符号
│       public @Options(RepeatMode.class) int RepeatMode() {
│               ^
│        符号:   类 Options
│        位置: 类 Tween
│      警告: 以下选项未被任何处理程序识别: '[output, org, root, version, extName]'
│      5 个错误
└ failed

• Build failed [1s 43ms] []

the Chinese error message is 'Error: can not find symbol'.

or maybe @Options annotation is not supported by an extensions?

Can you try to file the issue on GitHub as the OP said?