@@ -65,7 +65,7 @@ public ModelInfo(Configuration configuration) {
65
65
try {
66
66
scanForModel (configuration .getContext ());
67
67
}
68
- catch (IOException e ) {
68
+ catch (Exception e ) {
69
69
Log .e ("Couldn't open source path." , e );
70
70
}
71
71
}
@@ -124,38 +124,9 @@ private boolean loadModelFromMetaData(Configuration configuration) {
124
124
return true ;
125
125
}
126
126
127
- private void scanForModel (Context context ) throws IOException {
127
+ private void scanForModel (Context context ) throws Exception {
128
128
String packageName = context .getPackageName ();
129
- String sourcePath = context .getApplicationInfo ().sourceDir ;
130
- List <String > paths ;
131
-
132
- try {
133
- paths = MultiDexHelper .getAllClasses (context );
134
- } catch (Exception ex ) {
135
- paths = new ArrayList <String >();
136
- }
137
-
138
- if (sourcePath != null && !(new File (sourcePath ).isDirectory ())) {
139
- DexFile dexfile = new DexFile (sourcePath );
140
- Enumeration <String > entries = dexfile .entries ();
141
-
142
- while (entries .hasMoreElements ()) {
143
- paths .add (entries .nextElement ());
144
- }
145
- }
146
- // Robolectric fallback
147
- else {
148
- ClassLoader classLoader = Thread .currentThread ().getContextClassLoader ();
149
- Enumeration <URL > resources = classLoader .getResources ("" );
150
-
151
- while (resources .hasMoreElements ()) {
152
- String path = resources .nextElement ().getFile ();
153
- if (path .contains ("bin" ) || path .contains ("classes" )) {
154
- paths .add (path );
155
- }
156
- }
157
- }
158
-
129
+ List <String > paths = MultiDexHelper .getAllClasses (context );
159
130
for (String path : paths ) {
160
131
File file = new File (path );
161
132
scanForModelClasses (file , packageName , context .getClassLoader ());
0 commit comments