Skip to content

Commit be1d98d

Browse files
committed
Multidex fix
1 parent 1df6335 commit be1d98d

File tree

1 file changed

+3
-32
lines changed

1 file changed

+3
-32
lines changed

src/com/activeandroid/sebbia/ModelInfo.java

+3-32
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public ModelInfo(Configuration configuration) {
6565
try {
6666
scanForModel(configuration.getContext());
6767
}
68-
catch (IOException e) {
68+
catch (Exception e) {
6969
Log.e("Couldn't open source path.", e);
7070
}
7171
}
@@ -124,38 +124,9 @@ private boolean loadModelFromMetaData(Configuration configuration) {
124124
return true;
125125
}
126126

127-
private void scanForModel(Context context) throws IOException {
127+
private void scanForModel(Context context) throws Exception {
128128
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);
159130
for (String path : paths) {
160131
File file = new File(path);
161132
scanForModelClasses(file, packageName, context.getClassLoader());

0 commit comments

Comments
 (0)