Coder Social home page Coder Social logo

alibaba / arouter Goto Github PK

View Code? Open in Web Editor NEW
14.4K 365.0 2.6K 25.97 MB

💪 A framework for assisting in the renovation of Android componentization (帮助 Android App 进行组件化改造的路由框架)

License: Apache License 2.0

HTML 0.55% Java 89.96% Kotlin 2.34% Groovy 7.16%
android router navigation componentization dependency-injection interceptor

arouter's Introduction

    A framework for assisting in the renovation of Android app componentization

中文文档

Join the chat at https://gitter.im/alibaba/ARouter Hex.pm

Lastest version

module arouter-api arouter-compiler arouter-register arouter-idea-plugin
version Download Download Download as plugin

Demo

I. Feature

  1. Supports direct parsing of standard URLs for jumps and automatic injection of parameters into target pages
  2. Support for multi-module
  3. Support for interceptor
  4. Support for dependency injection
  5. InstantRun support
  6. MultiDex support
  7. Mappings are grouped by group, multi-level management, on-demand initialization
  8. Supports users to specify global demotion and local demotion strategies
  9. Activity, interceptor and service can be automatically registered to the framework
  10. Support multiple ways to configure transition animation
  11. Support for fragment
  12. Full kotlin support (Look at Other#2)
  13. Generate route doc support
  14. Provide IDE plugin for quick navigation to target class
  15. Support Incremental annotation processing
  16. Support register route meta dynamic.

II. Classic Case

  1. Forward from external URLs to internal pages, and parsing parameters
  2. Jump and decoupling between multi-module
  3. Intercept jump process, handle login, statistics and other logic
  4. Cross-module communication, decouple components by IoC

III. Configuration

  1. Adding dependencies and configurations

    android {
        defaultConfig {
            ...
            javaCompileOptions {
                annotationProcessorOptions {
                    arguments = [AROUTER_MODULE_NAME: project.getName()]
                }
            }
        }
    }
    
    dependencies {
        // Replace with the latest version
        compile 'com.alibaba:arouter-api:?'
        annotationProcessor 'com.alibaba:arouter-compiler:?'
        ...
    }
    // Old version of gradle plugin (< 2.2), You can use apt plugin, look at 'Other#1'
    // Kotlin configuration reference 'Other#2'
  2. Add annotations

    // Add annotations on pages that support routing (required)
    // The path here needs to pay attention to need at least two levels : /xx/xx
    @Route(path = "/test/activity")
    public class YourActivity extend Activity {
        ...
    }
  3. Initialize the SDK

    if (isDebug()) {           // These two lines must be written before init, otherwise these configurations will be invalid in the init process
        ARouter.openLog();     // Print log
        ARouter.openDebug();   // Turn on debugging mode (If you are running in InstantRun mode, you must turn on debug mode! Online version needs to be closed, otherwise there is a security risk)
    }
    ARouter.init(mApplication); // As early as possible, it is recommended to initialize in the Application
  4. Initiate the routing

    // 1. Simple jump within application (Jump via URL in 'Advanced usage')
    ARouter.getInstance().build("/test/activity").navigation();
    
    // 2. Jump with parameters
    ARouter.getInstance().build("/test/1")
                .withLong("key1", 666L)
                .withString("key3", "888")
                .withObject("key4", new Test("Jack", "Rose"))
                .navigation();
  5. Add confusing rules (If Proguard is turn on)

    -keep public class com.alibaba.android.arouter.routes.**{*;}
    -keep public class com.alibaba.android.arouter.facade.**{*;}
    -keep class * implements com.alibaba.android.arouter.facade.template.ISyringe{*;}
    
    # If you use the byType method to obtain Service, add the following rules to protect the interface:
    -keep interface * implements com.alibaba.android.arouter.facade.template.IProvider
    
    # If single-type injection is used, that is, no interface is defined to implement IProvider, the following rules need to be added to protect the implementation
    # -keep class * implements com.alibaba.android.arouter.facade.template.IProvider
    
  6. Using the custom gradle plugin to autoload the routing table

    apply plugin: 'com.alibaba.arouter'
    
    buildscript {
        repositories {
            mavenCentral()
        }
    
        dependencies {
            // Replace with the latest version
            classpath "com.alibaba:arouter-register:?"
        }
    }

    Optional, use the registration plugin provided by the ARouter to automatically load the routing table(power by AutoRegister). By default, the ARouter will scanned the dex files . Performing an auto-registration via the gradle plugin can shorten the initialization time , it should be noted that the plugin must be used with api above 1.3.0!

  7. use ide plugin for quick navigation to target class (Optional)

    Search for ARouter Helper in the Android Studio plugin market, or directly download the arouter-idea-plugin zip installation package listed in the Latest version above the documentation, after installation plugin without any settings, U can find an icon at the beginning of the jump code. (navigation) click the icon to jump to the target class that identifies the path in the code.

IV. Advanced usage

  1. Jump via URL

    // Create a new Activity for monitoring Scheme events, and then directly pass url to ARouter
    public class SchemeFilterActivity extends Activity {
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
            Uri uri = getIntent().getData();
            ARouter.getInstance().build(uri).navigation();
            finish();
        }
    }

    AndroidManifest.xml

    <activity android:name=".activity.SchemeFilterActivity">
        <!-- Scheme -->
        <intent-filter>
            <data
                android:host="m.aliyun.com"
                android:scheme="arouter"/>
    
            <action android:name="android.intent.action.VIEW"/>
    
            <category android:name="android.intent.category.DEFAULT"/>
            <category android:name="android.intent.category.BROWSABLE"/>
        </intent-filter>
    </activity>
  2. Parse the parameters in the URL

    // Declare a field for each parameter and annotate it with @Autowired
    @Route(path = "/test/activity")
    public class Test1Activity extends Activity {
        @Autowired
        public String name;
        @Autowired
        int age;
        @Autowired(name = "girl") // Map different parameters in the URL by name
        boolean boy;
        @Autowired
        TestObj obj;    // Support for parsing custom objects, using json pass in URL
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            ARouter.getInstance().inject(this);
    
            // ARouter will automatically set value of fields
            Log.d("param", name + age + boy);
        }
    }
    
    // If you need to pass a custom object, Create a new class(Not the custom object class),implement the SerializationService, And use the @Route annotation annotation, E.g:
    @Route(path = "/yourservicegroupname/json")
    public class JsonServiceImpl implements SerializationService {
        @Override
        public void init(Context context) {
    
        }
    
        @Override
        public <T> T json2Object(String text, Class<T> clazz) {
            return JSON.parseObject(text, clazz);
        }
    
        @Override
        public String object2Json(Object instance) {
            return JSON.toJSONString(instance);
        }
    }
  3. Declaration Interceptor (Intercept jump process, AOP)

    // A more classic application is to handle login events during a jump so that there is no need to repeat the login check on the target page.
    // Interceptors will be executed between jumps, multiple interceptors will be executed in order of priority
    @Interceptor(priority = 8, name = "test interceptor")
    public class TestInterceptor implements IInterceptor {
        @Override
        public void process(Postcard postcard, InterceptorCallback callback) {
            ...
            // No problem! hand over control to the framework
            callback.onContinue(postcard);  
            
            // Interrupt routing process
            // callback.onInterrupt(new RuntimeException("Something exception"));      
    
            // The above two types need to call at least one of them, otherwise it will not continue routing
        }
    
        @Override
        public void init(Context context) {
            // Interceptor initialization, this method will be called when sdk is initialized, it will only be called once
        }
    }
  4. Processing jump results

    // U can get the result of a single jump
    ARouter.getInstance().build("/test/1").navigation(this, new NavigationCallback() {
        @Override
        public void onFound(Postcard postcard) {
        ...
        }
    
        @Override
        public void onLost(Postcard postcard) {
        ...
        }
    });
  5. Custom global demotion strategy

    // Implement the DegradeService interface
    @Route(path = "/xxx/xxx")
    public class DegradeServiceImpl implements DegradeService {
        @Override
        public void onLost(Context context, Postcard postcard) {
            // do something.
        }
    
        @Override
        public void init(Context context) {
    
        }
    }
  6. Decoupled by dependency injection : Service management -- Exposure services

    // Declaration interface, other components get the service instance through the interface
    public interface HelloService extends IProvider {
        String sayHello(String name);
    }
    
    @Route(path = "/yourservicegroupname/hello", name = "test service")
    public class HelloServiceImpl implements HelloService {
    
        @Override
        public String sayHello(String name) {
            return "hello, " + name;
        }
    
        @Override
        public void init(Context context) {
    
        }
    }
  7. Decoupled by dependency injection : Service management -- Discovery service

    public class Test {
        @Autowired
        HelloService helloService;
    
        @Autowired(name = "/yourservicegroupname/hello")
        HelloService helloService2;
    
        HelloService helloService3;
    
        HelloService helloService4;
    
        public Test() {
            ARouter.getInstance().inject(this);
        }
    
        public void testService() {
            // 1. Use Dependency Injection to discover services, annotate fields with annotations
            helloService.sayHello("Vergil");
            helloService2.sayHello("Vergil");
    
            // 2. Discovering services using dependency lookup, the following two methods are byName and byType
            helloService3 = ARouter.getInstance().navigation(HelloService.class);
            helloService4 = (HelloService) ARouter.getInstance().build("/yourservicegroupname/hello").navigation();
            helloService3.sayHello("Vergil");
            helloService4.sayHello("Vergil");
        }
    }
  8. Pretreatment Service

    @Route(path = "/xxx/xxx")
    public class PretreatmentServiceImpl implements PretreatmentService {
        @Override
        public boolean onPretreatment(Context context, Postcard postcard) {
            // Do something before the navigation, if you need to handle the navigation yourself, the method returns false
        }
    
        @Override
        public void init(Context context) {
    
        }
    }
  9. Dynamic register route meta Applicable to apps with plug-in architectures or some scenarios where routing information needs to be dynamically registered,Dynamic registration can be achieved through the interface provided by ARouter, The target page and service need not be marked with @Route annotation,Only the routing information of the same group can be registered in the same batch

        ARouter.getInstance().addRouteGroup(new IRouteGroup() {
            @Override
            public void loadInto(Map<String, RouteMeta> atlas) {
                atlas.put("/dynamic/activity",      // path
                    RouteMeta.build(
                        RouteType.ACTIVITY,         // Route type
                        TestDynamicActivity.class,  // Target class
                        "/dynamic/activity",        // Path
                        "dynamic",                  // Group
                        0,                          // not need
                        0                           // Extra tag, Used to mark page feature
                    )
                );
            }
        });

V. More features

  1. Other settings in initialization

    ARouter.openLog(); // Open log
    ARouter.openDebug(); // When using InstantRun, you need to open this switch and turn it off after going online. Otherwise, there is a security risk.
    ARouter.printStackTrace(); // Print thread stack when printing logs
  2. API description

    // Build a standard route request
    ARouter.getInstance().build("/home/main").navigation();
    
    // Build a standard route request, via URI
    Uri uri;
    ARouter.getInstance().build(uri).navigation();
    
    // Build a standard route request, startActivityForResult
    // The first parameter must be Activity and the second parameter is RequestCode
    ARouter.getInstance().build("/home/main", "ap").navigation(this, 5);
    
    // Pass Bundle directly
    Bundle params = new Bundle();
    ARouter.getInstance()
        .build("/home/main")
        .with(params)
        .navigation();
    
    // Set Flag
    ARouter.getInstance()
        .build("/home/main")
        .withFlags();
        .navigation();
    
    // For fragment
    Fragment fragment = (Fragment) ARouter.getInstance().build("/test/fragment").navigation();
                        
    // transfer the object 
    ARouter.getInstance()
        .withObject("key", new TestObj("Jack", "Rose"))
        .navigation();
    
    // Think the interface is not enough, you can directly set parameter into Bundle
    ARouter.getInstance()
            .build("/home/main")
            .getExtra();
    
    // Transition animation (regular mode)
    ARouter.getInstance()
        .build("/test/activity2")
        .withTransition(R.anim.slide_in_bottom, R.anim.slide_out_bottom)
        .navigation(this);
    
    // Transition animation (API16+)
    ActivityOptionsCompat compat = ActivityOptionsCompat.
        makeScaleUpAnimation(v, v.getWidth() / 2, v.getHeight() / 2, 0, 0);
    
    // ps. makeSceneTransitionAnimation, When using shared elements, you need to pass in the current Activity in the navigation method
    
    ARouter.getInstance()
        .build("/test/activity2")
        .withOptionsCompat(compat)
        .navigation();
            
    // Use green channel (skip all interceptors)
    ARouter.getInstance().build("/home/main").greenChannel().navigation();
    
    // Use your own log tool to print logs
    ARouter.setLogger();
    
    // Use your custom thread pool
    ARouter.setExecutor();
  3. Get the original URI

    String uriStr = getIntent().getStringExtra(ARouter.RAW_URI);
  4. Rewrite URL

    // Implement the PathReplaceService interface
    @Route(path = "/xxx/xxx")
    public class PathReplaceServiceImpl implements PathReplaceService {
        /**
        * For normal path.
        *
        * @param path raw path
        */
        String forString(String path) {
            // Custom logic
            return path;
        }
    
    /**
        * For uri type.
        *
        * @param uri raw uri
        */
        Uri forUri(Uri uri) {
            // Custom logic
            return url;
        }
    }
  5. Generate router doc

    // Edit build.gradle, add option 'AROUTER_GENERATE_DOC = enable'
    // Doc file : build/generated/source/apt/(debug or release)/com/alibaba/android/arouter/docs/arouter-map-of-${moduleName}.json
    android {
        defaultConfig {
            ...
            javaCompileOptions {
                annotationProcessorOptions {
                    arguments = [AROUTER_MODULE_NAME: project.getName(), AROUTER_GENERATE_DOC: "enable"]
                }
            }
        }
    }

VI. Other

  1. Old version of gradle plugin configuration

    apply plugin: 'com.neenbedankt.android-apt'
    
    buildscript {
        repositories {
            mavenCentral()
        }
    
        dependencies {
            classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
        }
    }
    
    apt {
        arguments {
            AROUTER_MODULE_NAME project.getName();
        }
    }
    
    dependencies {
        compile 'com.alibaba:arouter-api:x.x.x'
        apt 'com.alibaba:arouter-compiler:x.x.x'
        ...
    }
  2. Kotlin project configuration

    // You can refer to the wording in the "module-kotlin" module
    apply plugin: 'kotlin-kapt'
    
    kapt {
        arguments {
            arg("AROUTER_MODULE_NAME", project.getName())
        }
    }
    
    dependencies {
        compile 'com.alibaba:arouter-api:x.x.x'
        kapt 'com.alibaba:arouter-compiler:x.x.x'
        ...
    }
    

VII. Communication

  1. Communication

    1. DingDing group1

      dingding

    2. QQ group1

      qq

    3. QQ group2

      qq

arouter's People

Contributors

act262 avatar alibaba-oss avatar crazy1235 avatar fanmingyi avatar fanturbo avatar hanshengjian avatar imknown avatar jaydroid1024 avatar jlleitschuh avatar jokermonn avatar knight-zxw avatar linxiaotao avatar lucifinilsu avatar luckybilly avatar miraclehen avatar tanglie1993 avatar yellow5a5 avatar yylyingy avatar zhi1ong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arouter's Issues

Build出错

我的build.gradle是:

compile 'com.alibaba:arouter-api:1.0.3'
annotationProcessor 'com.alibaba:arouter-compiler:1.0.3'

出错:

Error:Failed to resolve: annotationProcessor

==================================================
备注:
我把build.gradle中的1.0.3改成1.0.2仍失败, 同样的错误
但改为1.0.1就build成功了

请问是不是高版本的没有上传到仓库里?

不产生注解类

Look at here

集成到自己的项目中,修改了包路径,也在Const中修改。annotationProcessor等也引入了,apt:1.8也引入了。可以怎么编译运行,虽然不报错。但是也不在build中产生类文件。

希望加入序列化参数和对fragment的支持

1.序列化可以采用json序列化的形式,这样就能解决基本类型传输的问题.
2.至于fragment支持是因为为了复用有些fragment需要单独的去展示,Router这里指定一个容器activity,bundle原生不动的传递给fragment是可以的,参数自动注入这个功能非常好.

Autowired 没有数据

@Autowired
String id;
@Autowired
String openId;

ARouter.getInstance().build("/mdressstyle/DressStyleDetailActivity")
.withString("id", dressStyleInfoList.getRows().get(position).getId())
.withString("openId", AppData.USER_INFO.getStaff().getOpenId())
.navigation();

but id and openId 没有数据

关于 转场动画(API16+)的问题

// 转场动画(API16+)
ActivityOptionsCompat compat = ActivityOptionsCompat.makeScaleUpAnimation(v, v.getWidth() / 2, v.getHeight() / 2, 0, 0);
使用文档中提供的运行没问题。

String transitionName = getString(R.string.transition_shared_elements);
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this, view, transitionName);
但是使用共享元素进行跳转时发现页面无法正常显示(页面应该已经跳转了,但是页面元素都没显示出来)。

不同module间跳转问题

能简单概述下不同module间原理吗?跟了很久源码没看懂,后期能添加实现原理的文档吗?
顺便问下 _ARouter的类的_navigation方法中的intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);这个标记位有什么作用?实际好像没有新建任务栈

demo运行无法正常跳转

Aroute example运行log如下:
01-13 15:25:06.490 30616-30616/com.alibaba.android.arouter.demo I/ARouter::: ARouter start attachBaseContext
01-13 15:25:06.497 30616-30616/com.alibaba.android.arouter.demo I/ARouter::: ARouter hook instrumentation success!
01-13 15:25:06.527 30616-30616/com.alibaba.android.arouter.demo I/galaxy: VM with name 'Android' has multidex support
01-13 15:25:06.529 30616-30616/com.alibaba.android.arouter.demo D/galaxy: Filter 0 classes by packageName <com.alibaba.android.arouter.routes>
01-13 15:25:06.532 30616-30616/com.alibaba.android.arouter.demo D/ActivityThread: BIND_APPLICATION handled : 0 / AppBindData{appInfo=ApplicationInfo{32762597 com.alibaba.android.arouter.demo}}
01-13 15:25:06.533 30616-30616/com.alibaba.android.arouter.demo V/ActivityThread: Handling launch of ActivityRecord{258c3384 token=android.os.BinderProxy@32e29fa2 {com.alibaba.android.arouter.demo/com.alibaba.android.arouter.demo.MainActivity}}

按照readme里的集成方法集成到我自己的app中也是无法跳转,There's no routematched!

强迫症来挑骨头了

com.alibaba.android.arouter.compiler.utils.Consts.WARNING_TIPS="DO NOT EDIT THIE FILE..."
是不是有个单词手快打错了→_→
PS:项目666👍👍👍

暴露的服务注入为空

项目里有2个module,一个app,一个common.
我把app module里的Application 当作一个服务接口的实现类来提供给common module注入
但是注入的一直为空.我也调用了Arouter的init. 在需要注入的地方也调用了 ARouter.getInstance().inject(this);
注解也检查了很多遍都没有问题.
不知道为何一直注入不了?是不是这种方式使用不支持?

布局加载错误Bug

在app的layout文件加下添加与module同名的布局文件,使用Arouter跳转到module相应布局的Activity后加载的布局为app的layout下的布局而不是module下的布局。

点击不会跳转,在同一个module

当我点击跳的时候会有下面的log

W/ARouter::: ARouter::No postcard![ ]
W/ARouter::: ARouter::No postcard![ ]
D/ARouter::: The group [login] starts loading, trigger by [/login/LoginIndexActivity][ ]
D/ARouter::: The group [login] has already been loaded, trigger by [/login/LoginIndexActivity][ ]
I/: 这里是ARouter的跳转回调---onFound
I/ARouter::: Thread production, name is [ARouter task pool No.1, thread No.2][ ]<-----------这个是啥

initInterceptors 不考虑线程不安全吗

我在看代码的时候看到下面这段

 public static void initInterceptors() {
    executor.execute(new Runnable() {
        @Override
        public void run() {
            if (null != interceptorsIndex && interceptorsIndex.size() > 0) {
                for (Map.Entry<Integer, Class<? extends IInterceptor>> entry :   interceptorsIndex.entrySet()) {
                    Class<? extends IInterceptor> interceptorClass = entry.getValue();
                    try {
                        IInterceptor iInterceptor = interceptorClass.getConstructor().newInstance();
                        iInterceptor.init(mContext);
                        interceptors.add(iInterceptor);
                    } catch (Exception ex) {
                        throw new HandlerException(TAG + "ARouter init interceptor error! name = [" + interceptorClass.getName() + "], reason = [" + ex.getMessage() + "]");
                    }
                }

                interceptorHasInit = true;

                logger.info(TAG, "ARouter interceptors init over.");

                synchronized (interceptorInitLock) {
                    interceptorInitLock.notifyAll();
                }
            }
        }
    });
}

发现好像不是线程安全的?

Arouter一直无法跳转,出现There is no route.....

开发大大你好,最近开始使用Arouter

出现问题的项目可以直接看源码的,因为这是一个开源项目:

他们分别是:

目标activity:PhotoMultiBrowserActiviry

调用的adapter:PhotoSelectAdapter line:203

根据文档,我已经写好了注解,没有主动分组,相关dependence也有了,GroupIndex =1,但还是没法跳转

相关截图如下(国内图床,因为怕无法显示出图片,所以把连接也一同附上):

gradle:
gradle

gradle图片链接

init:
init

initLogcat图片链接

跳转:
跳转

跳转Logcat图片链接

关于DegradeService的建议

你好。
DegradeService字面意思不是太明白,我是理解为类似全局onLost捕获
我想能不能给DegradeService做单独处理,类似Interceptor一样,现在我这样去定义一个DegradeService

@Route(path = "/xxx/123")
public class GlobalDegradeService implements DegradeService {

    @Override
    public void init(Context context) {
        System.out.println("全局降级处理初始化");
    }

    @Override
    public void onLost(Context context, Postcard postcard) {
        System.out.println("全局降级处理");
    }

    public void customCall() {
        System.out.println("我是自定义调用");
    }
}

如果我跳转的path和GlobalDegradeService中定义的path,如果刚好一样的话,它就变成去获取一个Service,我想这样可能会让人感到困惑。如果它的定义是全局onLost捕获,那我觉得单独处理会合理点。

icon冲突

Error:Execution failed for task ':app:processAutoupdateDebugManifest'.
> Manifest merger failed : Attribute application@icon value=(@mipmap/ic_launcher) from AndroidManifest.xml:7:9-43
  	is also present at [com.alibaba:arouter-api:1.0.3] AndroidManifest.xml:14:18-54 value=(@drawable/ic_launcher).
  	Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:5:5-22:19 to override.

Multiple dex files define Lcom/alibaba/android/arouter/routes/ARouter$$Group$$service;

1.配置一切正常。
2.我目前用了ARouter 暴露服务的功能
3.我的项目进行分包。modelA 依赖于lib.framework.在lib.framework中有服务暴露了,就是继承了IProvider,然后在modelA中我也新建了服务(继承了IProvider)
.然后在编译的时候提示:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Error:java.lang.RuntimeException: com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/alibaba/android/arouter/routes/ARouter$$Group$$service;
Error:com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/alibaba/android/arouter/routes/ARouter$$Group$$service;
Error:com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/alibaba/android/arouter/routes/ARouter$$Group$$service;
Error:java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/alibaba/android/arouter/routes/ARouter$$Group$$service;
Error:com.android.dex.DexException: Multiple dex files define Lcom/alibaba/android/arouter/routes/ARouter$$Group$$service;

Fragment 中 开启Activity,在Fragment中不回调onActivityResult

1.Fragment 中 开启Activity带requestCode ,开启的Activity关闭后,不会回调Fragment中的onActivityResult.
只会调用Fragment 所在Activity的onActivityResult.

2.用系统自带的开启Activity方式是Activity和Fragment中的onActivityResult都会执行.

3.现在需求在Fragment 中开启Activity然后在Activity关闭后回调fragment中的方法执行相应功能就没法做了.

4.是否会在近期版本修复这个问题?或者有什么其他的解决方法?

编译出错

Gradle Version: Gradle 3.3
Gradle Plugin Version: gradle:2.3.0-beta2

我按照readme和demo的方式配置了gradle,工程里之前也配置了Dagger2,用的annotationProcessor,
之前都是正常的,使用了ARouter之后,就编译不过了。gradle console给了下面的错误,不知道是什么原因导致了Dagger2没有编译成功。
注: ARouter::Compiler The user has configuration the module name, it was [app]
注: ARouter::Compiler >>> InterceptorProcessor init. <<<
警告: No SupportedSourceVersion annotation found on com.alibaba.android.arouter.compiler.processor.InterceptorProcessor, returning RELEASE_6.
警告: 来自注释处理程序 'com.alibaba.android.arouter.compiler.processor.InterceptorProcessor' 的受支持 source 版本 'RELEASE_6' 低于 -source '1.8'
注: ARouter::Compiler The user has configuration the module name, it was [app]
注: ARouter::Compiler >>> RouteProcessor init. <<<
/Users/admin/Desktop/Ukee/app/src/main/java/com/yujie/ukee/App.java:10: 错误: 找不到符号
import com.yujie.ukee.dagger.injection.DaggerAppComponent;
^
符号: 类 DaggerAppComponent
位置: 程序包 com.yujie.ukee.dagger.injection

Module中的Autowired不起作用

clone了Arouter的源码,编辑了demo中的代码, 在app的activity中添加Autowired标记的字段有效,但是在module的activity中添加Autowired标记的字段不起作用,也不会自动生成xxxActivity$$Arouter$$Autowired文件

在ActivityA 新跳转到 ActivityA 失败 (就是 Activity 默认的启动模式)

03-08 15:44:06.276 17311-17311/me.ifitting.app.debug W/ARouter::: ARouter::No postcard![ThreadId=1 & ThreadName=main & FileName=_ARouter.java & ClassName=com.alibaba.android.arouter.launcher._ARouter & MethodName=navigation & LineNumber=252 ] 
03-08 15:44:06.276 17311-17311/me.ifitting.app.debug W/ARouter::: ARouter::No postcard![ThreadId=1 & ThreadName=main & FileName=_ARouter.java & ClassName=com.alibaba.android.arouter.launcher._ARouter & MethodName=navigation & LineNumber=252 ] 

README

五、更多功能

  1. 重写跳转URL
public class PathReplaceServiceImpl implements DegradeService {

接口是不是实现错了?应该是实现PathReplaceService接口吧

public class PathReplaceServiceImpl implements PathReplaceService {

Interceptor拦截,处理之后,该如何跳转到拦截之前想跳转的位置

您好,我有个问题想请教下。

比如:从Activity A想要跳转到Activity B,但是B需要登录,于是我在Interceptor中拦截这个跳转事件,修改Postcard的目的地为LoginActivity,登录结束之后会回到Activity A,如何才能让登录结束后,直接跳转到该事件原先想要跳转的位置呢?

非常感谢。

net::ERR_UNKNOWN_URL_SCHEME,请问这种如何解决?

三星真机:跑demo

url跳转跳转失败,依旧停留在webview界面。
界面显示 找不到网页!!!net::ERR_UNKNOWN_URL_SCHEME
日志:
03-15 16:14:46.314 1968-1968/com.alibaba.android.arouter.demo W/BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 1968
03-15 16:14:46.334 1968-1968/com.alibaba.android.arouter.demo W/BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 1968
03-15 16:14:46.344 1968-1968/com.alibaba.android.arouter.demo I/chromium: [INFO:CONSOLE(0)] "Not allowed to load local resource: file:///android_asset/webkit/android-weberror.png", source: data:text/html,chromewebdata (0)

Release版本无法跳转,Debug版本没问题

Look at here

  • → Did you read the doc carefully: yes
  • → Did you add annotation above target activity: yes
  • → Did you add annotation processor dependence: yes
  • Receive only bugs and suggestions

用的最新版:
def aRouterApiVersion = "1.2.0"
def aRouterCompilerVersion = "1.1.0"

问题:调试的时候可以跳转,但是release的发布版无法跳转,代码都一样,求解。

编译问题

Error:Unknown host 'mirrors.taobao.net'. You may need to adjust the proxy settings in Gradle.
项目编译出现这个问题 请问如何解决

最基础的跳转问题。。。

帮忙看下。log显示 init成功 然后跳转不过去,
There is no route match the path [player], in group [main][ ]
W/ARouter::: ARouter::No postcard![ ]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.