diff --git a/profman/profman.cc b/profman/profman.cc
index d0c99e0..91061a6 100644
--- a/profman/profman.cc
+++ b/profman/profman.cc
@@ -39,6 +39,7 @@
 #include "boot_image_profile.h"
 #include "bytecode_utils.h"
 #include "dex_file.h"
+#include "dex_file_types.h"
 #include "jit/profile_compilation_info.h"
 #include "profile_assistant.h"
 #include "runtime.h"
@@ -668,14 +669,14 @@
       constexpr uint16_t kInvalidMethodIndex = std::numeric_limits<uint16_t>::max() - 1;
       return kInvalidMethodIndex >= dex_file->NumMethodIds()
              ? kInvalidMethodIndex
-             : DexFile::kDexNoIndex;
+             : dex::kDexNoIndex;
     }
 
     std::vector<std::string> name_and_signature;
     Split(method_spec, kProfileParsingFirstCharInSignature, &name_and_signature);
     if (name_and_signature.size() != 2) {
       LOG(ERROR) << "Invalid method name and signature " << method_spec;
-      return DexFile::kDexNoIndex;
+      return dex::kDexNoIndex;
     }
 
     const std::string& name = name_and_signature[0];
@@ -684,24 +685,24 @@
     const DexFile::StringId* name_id = dex_file->FindStringId(name.c_str());
     if (name_id == nullptr) {
       LOG(WARNING) << "Could not find name: "  << name;
-      return DexFile::kDexNoIndex;
+      return dex::kDexNoIndex;
     }
     dex::TypeIndex return_type_idx;
     std::vector<dex::TypeIndex> param_type_idxs;
     if (!dex_file->CreateTypeList(signature, &return_type_idx, &param_type_idxs)) {
       LOG(WARNING) << "Could not create type list" << signature;
-      return DexFile::kDexNoIndex;
+      return dex::kDexNoIndex;
     }
     const DexFile::ProtoId* proto_id = dex_file->FindProtoId(return_type_idx, param_type_idxs);
     if (proto_id == nullptr) {
       LOG(WARNING) << "Could not find proto_id: " << name;
-      return DexFile::kDexNoIndex;
+      return dex::kDexNoIndex;
     }
     const DexFile::MethodId* method_id = dex_file->FindMethodId(
         dex_file->GetTypeId(class_ref.type_index), *name_id, *proto_id);
     if (method_id == nullptr) {
       LOG(WARNING) << "Could not find method_id: " << name;
-      return DexFile::kDexNoIndex;
+      return dex::kDexNoIndex;
     }
 
     return dex_file->GetIndexForMethodId(*method_id);
@@ -848,7 +849,7 @@
     }
 
     const uint32_t method_index = FindMethodIndex(class_ref, method_spec);
-    if (method_index == DexFile::kDexNoIndex) {
+    if (method_index == dex::kDexNoIndex) {
       return false;
     }
 
