Java 谷歌对安卓没有任何课程的反思

Java 谷歌对安卓没有任何课程的反思,java,android,reflection,reflections,Java,Android,Reflection,Reflections,我正试图使用反射库来获取所有带有特定Java注释的类 我将反射库包括在.gradle文件中: compile 'org.reflections:reflections:0.9.10' 但是,该库在Android上不适用于我。我没有从getsubsubsof或getTypesAnnotatedWith中得到任何点击 我的实现有什么问题吗 package sample.anotherapp; import android.os.Bundle; import android.support.v7.

我正试图使用反射库来获取所有带有特定Java注释的类

我将反射库包括在.gradle文件中:

compile 'org.reflections:reflections:0.9.10'
但是,该库在Android上不适用于我。我没有从
getsubsubsof
getTypesAnnotatedWith
中得到任何点击

我的实现有什么问题吗

package sample.anotherapp;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import org.reflections.Reflections;
import org.reflections.scanners.SubTypesScanner;
import org.reflections.scanners.TypeAnnotationsScanner;

import java.util.Set;

@Deprecated
public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Reflections reflections = new Reflections("sample.anotherapp", new SubTypesScanner(false), new TypeAnnotationsScanner());

        Set<Class<? extends AppCompatActivity>> subTypesOf = reflections. getSubTypesOf(AppCompatActivity.class);
        int size = subTypesOf.size();

        Set<Class<?>> annotated = reflections. getTypesAnnotatedWith(Deprecated.class);
        size = annotated.size();
    }
}
package sample.anotherapp;
导入android.os.Bundle;
导入android.support.v7.app.AppActivity;
导入org.reflections.reflections;
导入org.reflections.scanners.subsubscriptscanner;
导入org.reflections.scanners.TypeAnnotationsCanner;
导入java.util.Set;
@不赞成
公共类MainActivity扩展了AppCompatActivity{
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
反射反射=新反射(“sample.anotherapp”、新子类扫描程序(false)、新类型注释扫描程序());
Set>annotated=reflections.getTypesAnnotatedWith(弃用的.class);
size=带注释的.size();
}
}

所以问题可能是。。。Google reflections library是否能在Dalvik上运行

你实现了让它工作吗?你实现了让它工作吗?